nef to jpg conversion loses exif data?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
vortex1111vortex

nef to jpg conversion loses exif data?

Post by vortex1111vortex »

I'm using this command:

Code: Select all

mogrify -path convert2/jpgsQuality100/ -quality 100 -chop 0x10 -format jpg *.nef
To convert a batch of nef files to jpgs.

ImageMagick is losing all the EXIF data though... am I missing something?

I was able to do a similar conversion with ufraw, without losing the EXIF data.

This command is showing me some EXIF data (though it doesn't specify it as EXIF)

Code: Select all

identify -verbose _DSC8361.nef
 Base filename: _DSC8361.nef
  Format: NEF (Nikon Digital SLR Camera Raw Image File)
  Class: DirectClass
  Geometry: 2868x4320+0+0
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 16-bit
  Channel depth:
    Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
  Channel statistics:
    Red:
      Min: 3 (4.57771e-05)
      Max: 65501 (0.999481)
      Mean: 38827.4 (0.592468)
      Standard deviation: 18574 (0.283421)
    Green:
      Min: 3 (4.57771e-05)
      Max: 65361 (0.997345)
      Mean: 37917 (0.578577)
      Standard deviation: 19331.4 (0.294979)
    Blue:
      Min: 3 (4.57771e-05)
      Max: 65215 (0.995117)
      Mean: 37667 (0.574762)
      Standard deviation: 20755.1 (0.316703)
  Rendering intent: Undefined
  Resolution: 72x72
  Units: Undefined
  Filesize: 70.8948mb
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 2868x4320+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Dng:Aperture: F9
  Dng:AutoBlack: 1
  Dng:AutoExposure: 1
  Dng:ChannelMultipliers: 1.671875 1.000000 1.539063
  Dng:CreateID: 1
  Dng:Crop: 0 0 2868 4320
  Dng:EXIFSource: exiv2 0.16
  Dng:Exposure: -0.047403
  Dng:FocalLength: 50.0 mm
  Dng:FocalLength35: 75.0 mm
  Dng:Green: 1.070282
  Dng:ISOSpeed: 160
  Dng:Lens: 50mm F1.4
  Dng:Make: NIKON
  Dng:Model: D2Xs
  Dng:Orientation: 5
  Dng:Shutter: 1/100 s
  Dng:Temperature: 5403
  Dng:Timestamp: Wed Apr 15 13:43:37 2009
  Signature: 1063f11c00bf9c7b6a38294ca926af775bbe78196ca0fb45380d8292eea66dbb
  Tainted: False
  User time: 0.270u
  Elapsed time: 0:02
  Pixels per second: 11.8158mb
  Version: ImageMagick 6.3.7 02/18/08 Q16 http://www.imagemagick.org


How do I get it to copy the appropriate info into the JPG?
vortex1111vortex

Re: nef to jpg conversion loses exif data?

Post by vortex1111vortex »

Hmm, well, here is what I came up with. It appears that image Magick uses either dcraw or ufraw (which uses dcraw) anyway. But the settings that it feeds in result in losing the EXIF data.

So now, I'm using ufraw to first convert to png (with exif data)

Code: Select all

ufraw-batch --out-type png16 --exif *.nef
And then I'm feeding that into image magick to convert over to a jpeg....

Code: Select all

mogrify -path . -quality 100 -chop 0x10 -format jpg *.png
This seems to work pretty well. Thoughts? Is this the best way to maintain good quality, while scripting a batch of files for raw nef -> jpg?

Oh, and I'm using the -chop command because ufraw is putting 10 rows of corrupt pixels at the top of the png files. I don't know whats up with that. Something weird about this particular camera - in fact, the embedded jpg in the .nef file is 10 pixels smaller than the png on each edge.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: nef to jpg conversion loses exif data?

Post by magick »

We have a patch in the Subversion trunk (available sometime tomorrow) to fix the problem you reported. Thanks.
Post Reply