Extracting Thumbnail Images

Started by greybeard, October 16, 2023, 09:01:57 AM

Previous topic - Next topic

greybeard

I am writing an application to read SD cards containing raw image files from digital cameras and show thumbnails as a grid. Cards may be slow so this needs to be a very efficient process to be useable.

I'm trying to avoid reading the entire, possibly large, raw file and just extract the thumbnail.

Exiftool may not be the solution as I want the application to run on platforms that don't easily support perl (such as iOS and iPadOS).

Sony (ARW) and FujiFilm (RAF) images seem relatively straightforward but many other raw formats don't seem to contain thumbnails in a normal readable jpeg format - in many cases Exiftool seems to synthesize the thumbnails rather than simply extracting them (Nikon NEF files for example).

It must be possible to achieve this as the major operating systems are able to quickly show thumbnail images from raw formats that they support.

Any suggestions or thoughts?

Phil Harvey

ExifTool generates a ThumbnailTIFF for some image types, but for NEF the thumbnail is an embedded JPEG that is easily extracted from one of the SubIFD's.

If you want the best speed, I think you are doing it the right way.  There may be libraries that will do this for you more easily, but they will always be slower than an optimized approach.

- 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 ($).

greybeard

Thanks for the quick response Phil - maybe there are different types of NEF file from different models?

I downloaded a sample from a D6 and Exiftool reported a generated ThumbnailTIFF in the IFD0 group.

The SubIFDs have JpgFromRaw and OtherImage - both are larger than I would expect for a thumbnail.

Phil Harvey

You're probably right that different models store this differently.  I only checked for one sample (Z9 as it turns out), and I shouldn't have generalized.

- 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 ($).