Reading EXIF without entire image

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
till213

Reading EXIF without entire image

Post by till213 »

Hi list,

can I extract EXIF data from an image without reading the entire image?

Currently I have something like this:

Code: Select all

    try
    {
        Magick::Image image(filePath);

        exif["DateTime"] = QString(image.attribute("EXIF:DateTime").c_str());
        exif["Model"] = QString(image.attribute("EXIF:Model").c_str());
        ...
    }
    catch (Magick::Exception &ex)
    {
       ...
    }
This works, but it takes too long (> 2 seconds per JPEG image, resolution ~ 2500x2000, which are on disk, so it really seems that the entire image is read; is this interpretation correct?)

Thanks, Oliver
till213

Re: Reading EXIF without entire image

Post by till213 »

So I have done the following comparison with some photo JPEG images (around 2500 x 2000):

ImageMagick 6.3.2, Release, compiled with VS 6, quantum depth 8:

identify.exe -format "%[exif:*] myImage.jpg

Takes some time, about 0.5 seconds or more ("subjective measurement")

EXIV 0.15, Debug (!), VS 2005 Express (http://www.exiv2.org/)

exiv2.exe myImage.jpg

Prints EXIF data "instantly".


So I believe that ImageMagick (I am using the C++ API), as I have used it, really loads the whole image data. But at this point I am really only interested in the EXIF data.

Hence the question: Is there a way to extract the EXIF data only, without reading the whole image data (possibly with the C API/low level API)?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Reading EXIF without entire image

Post by anthony »

ImageMagick can not possibly handle all situations for all image formats. Especially in cases where you want it to ignore the image data which is the primary purpose on IM.

I suggest you look for a specific image file format tool for EXIF for TIFF. When you find one please let me know so I can include it on the IM Examples, File Formats Page.

If it was JPEG I would have suggested 'jhead', but for TIFF no one has reported to us a program to do this type of thing. Sorry it is out of the scope of the IM project.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply