Get exif from file without image class

I am trying to get a jpg preview from a DNG file (not a thumbnail). From what I can tell, the preview is just an exif preview, not DNG specific. However, like me, I cannot find anything on how to get a preview from an exif file in C #.

http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html

From this site, you can see that the preview starts with tag ID 0x0111, SubIFD1 group for DNG. The length is 0x0117, SubIFD1. But I don't understand what the group means. I have used Image.GetPropertyItem () before, but I think that since the file is DNG it will not allow me to load it as an image, I am getting an out of memory exception which can apparently mean it is an unrecognized pixel format ...

Is the image format intrinsic to exif information or is there a way to read it without the need for DNG decoding?

I know there are libraries built to open DNG, but so far I have not been able to adapt them to my software and I would like to keep it fast and lightweight. If I can just rip out this preview, it would be a really perfect situation.

+3


source to share


1 answer


The DNG specification is a TIFF extension, so if you have a TIFF decoder that supports JPEG compression, it should be able to decode the preview image (JPEG preview is decoded). You may need to "help" by pointing the decoder to the correct sub-IFD.

Otherwise, you can parse the TIFF structure, find the correct IFD, and use a JPEG decoder to decode the embedded JPEG preview.



I created a reader in Java (still working) that parses the TIFF structure and extracts the thumbnail (if present) and preview (and some lame attempts to extract uncompressed RAW CFA data that are far from complete). While the code is not yet production quality, it might give you some inspiration.

Good luck! :-)

0


source







All Articles