Deduct final image crop-size from Nikon-tags?

Started by Fimagena, July 12, 2015, 09:25:59 AM

Previous topic - Next topic

Fimagena

Hi,

I'm working on a raw-converter. One challenge is to crop the final picture correctly, i.e., to the "right" dimensions (by which I mean the size of the corresponding camera-JPEG and what, e.g., Lightroom would deliver when reading the raw). The sensor-size/data is usually bigger than the final crop and the size of the frame around the final output crop is not standardised between vendors and models.

Example: Sony A7s sensor size is 6048x4024, visible area is 6024x4024, final crop is 6000x4000 (with a 12px frame).

Most raw-formats include a tag specifying the final crop size (e.g., Sony FullImageSize, Olympus CropWidth/Height, Canon writes Exif-Pixel[XY]Dimension, ...). Unfortunately, Nikon's NEF does not - there is OutputImageWidth/Height but it does seem to be written only by very few models (at least in the sample set of Nikon-files I have...?). Also, CropHiSpeed shows the crop-size but it seems to relate to the visible area, not the final crop.

Question: Is there another way to deduct the final crop-size for NEFs? Couldn't find anything in the tag-listing, but maybe I'm missing something?

(If not, is anybody aware of a database of standard Nikon-picture sizes per model or something similar? Given that there are lots of raw-converters that get this right, I assume the information is available somewhere.)

Many thanks!

Phil Harvey

I'm not sure exactly what you mean by "get this right".  Different raw converters sometimes produce different sized output images.  In general, dcraw produces the largest output image possible, and often larger than other converters.  I would look to the dcraw source code to see how it does this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Fimagena

Fair enough. What I'm looking to do is not to maximise the picture size but to imitate the size of the equivalent JPEG straight out of the camera (which is also what Lightroom gives you when loading a raw-file). Basically what Adobe's DNG-converter writes into the DefaultCropOrigin/DefaultCropSize tags. This is usually smaller than the recorded ("visible") sensor size because it leaves a frame for interpolating the edge-pixels.

Many cameras have tags for that, Nikon apparently not. Interesting that Adobe can do this, although that information is apparently not encoded in their camera profile files. Means they either have hardcoded camera-information in the executable or they know of some relevant tags that we don't...

You are right that my "lots of raw-converters" is wrong and "some proprietary raw-converters" probably more accurate. To my understanding/tests, dcraw maximises the picture size and doesn't care about the vendor-defined final crop size (but will check again).

Phil Harvey

You're right.  I don't think that dcraw cares about the crop size used by the manufacturer.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).