NEF to JPG conversion

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
ChrisH
Posts: 3
Joined: 2013-03-18T11:52:26-07:00
Authentication code: 6789

NEF to JPG conversion

Post by ChrisH »

While converting from a .NEF file to .jpg file, I noticed two issues. First the jpg image has added black columns of pixels on the one edge now. Second, the color has also changed from the original, making the jpg brighter.

Are there additional options that could be applied to resolve these issues? Any suggestions are appreciated. Thanks!

Here is the command line used in ImageMagick 6.8.2-3 2013-01-30 Q16.

convert input.NEF -quality 98% output.jpg
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: NEF to JPG conversion

Post by snibgo »

What camera are you using? My Nikon D800 produces black pixels down one side. I think this is because dcraw pulls out all the available pixels, including the ones down the side of the sensor that don't get any light. When the image is trimmed to the manufacturer's specified number of pixels, I don't get any black pixels.
Second, the color has also changed from the original, making the jpg brighter
What original? The NEF file is the original. Everything else (including any image you see on your computer screen) is processed from that original.

If you are comparing it to the JPG produced by the camera, it will be different. Any in-camera processing is applied during the processing by the camera. ImageMagick doesn't know about this proccesing, so won't apply it.
snibgo's IM pages: im.snibgo.com
ChrisH
Posts: 3
Joined: 2013-03-18T11:52:26-07:00
Authentication code: 6789

Re: NEF to JPG conversion

Post by ChrisH »

Thank you for the explanation regarding the black pixels. This makes sense with what I'm seeing.

I'm working with a D800E. The pics were taking in the NEF format. When I compare a JPG converted from the NEF format in a Nikon software to a JPG from the same NEF converted in ImageMagick, I notice that some neutral tones are becoming blown out. I don't want to lose those details. Are there any options in ImageMagick to apply during the conversion so that this does not happen?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: NEF to JPG conversion

Post by fmw42 »

I don't know much about NEF format. But any such settings or defines would usually be identified at http://www.imagemagick.org/script/formats.php#supported and I do not see any for NEF.

There are controls for creating the JPG. See the same file as above and also http://www.imagemagick.org/Usage/formats/#jpg

It is mostly -quality and -compression and -sampling-factor.

But you can apply many different brightness, contrast like operators (linear or non-linear) during the conversion to maintain such detail.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: NEF to JPG conversion

Post by snibgo »

What exactly do you mean by "some neutral tones are becoming blown out"?

I use dcraw directly, rather than letting ImageMagick use dcraw as a delegate. That way, I have full control over white balance etc, including over options that ensure highlights don't become blown out, or even to recover blown highlights. I can even get the totally raw Bayer data, as it came off the sensor, should I want it.

Then, IM has a vast array of image processing abilities, before saving the image as JPG, TIFF, PNG or whatever. See http://www.imagemagick.org/script/comma ... ptions.php
snibgo's IM pages: im.snibgo.com
ChrisH
Posts: 3
Joined: 2013-03-18T11:52:26-07:00
Authentication code: 6789

Re: NEF to JPG conversion

Post by ChrisH »

Thanks for the links.

I'm just trying to find a way to keep the same quality in the JPGs that I see in the NEF files. But I don't really understand all of these options. Could this be a color space or profile issue?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: NEF to JPG conversion

Post by snibgo »

My crystal ball is on the blink. If you put up a NEF file and the corresponding camera's JPEG, that might help. (Put them on a free site somewhere, and post the URLs here.)

You should, of course, be able to get a better quality image from the NEF than the camera's JPEG. Otherwise, there's no point to keeping the NEF.
snibgo's IM pages: im.snibgo.com
Post Reply