Closed runfalk closed 4 years ago
Could you elaborate your purpose? If you are interested in the fields in Exif IFD in NEF, this library can read them as it is. On the other hand, if you are interested in the fields in "SubIFDs", using this library to read them does not make sense to me because they are not Exif fields.
Random observations follow:
Wikipedia says Nikon NEF is based on TIFF/EP. TIFF/EP is a different standard than TIFF or Exif. TIFF/EP reuses the basic structure from TIFF and Exif, but also has several differences especially in tag name spaces and IFD handling. Considering the nature of these differences, I do not like to overload TIFF/EP parser on top of Exif parser as your PoC code does.
So, my purpose was to extract correct width and height from the metadata in NEF files (since exif-rs gives the width and height of a built-in thumbnail currently). I'm writing an organization system for all my digital photos and videos and to me it would be convenient to use a single library for all image metadata parsing.
One interesting thing about the NEF SubIFDs is that it contains the camera's own full resolution JPEG version of the image. This means that it's possible to extract a good looking thumbnail quickly without resorting to RAW processing.
I didn't realize TIFF came in different flavors. I do agree TIFF/EP support may be out of scope.
Thank you for the clarification. You want to extract the image size and JPEG byte stream from SubIFDs without RAW format library. I do not think it is in scope, but I will keep it in mind that there is such a demand. If the implementation does not interfere with the main Exif functionality, I will not object this library having such a feature.
I checked a draft of ISO 12234-2 (TIFF/EP) and found that the IFD structure is more complex than "IFD number + sub IFD number". It's a tree, where child IFDs are "two-dimensional", meaning that they form not only an array in SubIFDs but also chains using next IFD pointers from the array.
Thank you for your response and helpful input. I'll close this PR.
Hi!
I tried to use your library with Nikon RAW images (NEF) and it seemed to work but some values were quite a bit off. It turns out that Nikon uses SubIFDs to store data about the full image. I whipped together an implementation that adds SubIFD support for exif-rs but I am unsure on how to implement it properly
I used this example image (you can find more formats at https://raw.pixls.us/)
As you can see
ImageWidth
andImageLength
inprimary
is only 160x120. However, the real dimensions are 4992x3280 which can be found in SubIFD1 (IFD0-1/ImageWidth
).Do you think that supporting this is within scope for exif-rs?