Page 1 of 1

Reading EXIF without entire image

Posted: 2007-10-26T09:12:32-07:00
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

Re: Reading EXIF without entire image

Posted: 2007-10-26T14:20:22-07:00
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)?

Re: Reading EXIF without entire image

Posted: 2007-11-22T17:43:15-07:00
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.