Project

General

Profile

How open just metadata image

Added by Thaisa Correia almost 7 years ago

Hi,

I'm accessing the image metadata as follows:

Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
assert(image.get() != 0);
image->readMetadata();
Exiv2::XmpData xmpData = image->xmpData();

However, working with a large volume of data, use this function (readMetadata()) is not feasible for the delay.

Is there any way to open only the image metadata? Rather than open the full image file? Or any way to optimize this process?

Best regards.


Replies (5)

RE: How open just metadata image - Added by Robin Mills almost 7 years ago

The library has been optimised to minimise I/O in two ways.

  1. It uses Memory Mapping when available (which it is normal on Mac/Windows/Linux)
  2. When MM is not available, it reads small blocks and seeks along the file to avoid reading the whole image.

Typically, the metadata in an image is located in the first 100k and that's all that is read. I did a comparison of opening images on the Mac using NSImageRep. Exiv2 was about 100x faster and I concluded that NSImageRep was building a frame buffer of the whole image. Exiv2 does not.

Can you provide an image that exhibits a "delay" and I will investigate.

RE: How open just metadata image - Added by Thaisa Correia almost 7 years ago

Thanks for answer.

I'm doing test through an application developed in C++/ Qt, to access only the XMP metadata.

Attached is the image captured by PhaseOne ("cap_1080.IIQ"), used in the process.

The problem of slow reading (image->readMetadata()) occurs when a large volume of images are processed.

I tested through Exiv2 application from the command prompt, and the same problem occurred.

Thanks again.

RE: How open just metadata image - Added by Thaisa Correia almost 7 years ago

Sorry, the previous file does not contain the metadata.

This file is the correct: https://dl.dropboxusercontent.com/u/9805638/cap_1226.IIQ

Thanks.

RE: How open just metadata image - Added by Robin Mills almost 7 years ago

Thank You for reporting this and for providing the test file.

I've looked at your file and I see there is a noticeable delay in opening your file with the exiv2(.exe) application.

522 rmills@rmillsmbp:~/Downloads $ ls -alt cap_1226.IIQ 
-rw-r--r--@ 1 rmills  staff  87522505 28 Jan 17:45 cap_1226.IIQ
523 rmills@rmillsmbp:~/Downloads $ time exiv2 -px -g GPSTimeStamp cap_1226.IIQ 
Xmp.exif.GPSTimeStamp                        XmpText    18  14:13:08.431+00:00
real    0m1.120s user    0m0.636s sys    0m0.212s
By comparison, I took 50 photos this morning for a total storage of 334mb.
516 rmills@rmillsmbp:~/Downloads $ du -m ~/Photos/Bush43Library/
334    /Users/rmills/Photos/Bush43Library/
517 rmills@rmillsmbp:~/Downloads $ ls -1 ~/Photos/Bush43Library/ | wc
      50      50     650
518 rmills@rmillsmbp:~/Downloads $ time exiv2 -pa -g DateTimeOriginal ~/Photos/Bush43Library/*.jpg
/Users/rmills/Photos/Bush43Library/DSC_4472.jpg  Exif.Photo.DateTimeOriginal                  Ascii      20  2015:01:28 11:00:06
...
/Users/rmills/Photos/Bush43Library/DSC_4521.jpg  Exif.Photo.DateTimeOriginal                  Ascii      20  2015:01:28 13:38:49
real    0m0.127s user    0m0.098s sys    0m0.017s
So we processed 50xJPGs/335mb in 0.1 seconds. However 1xIIQ/87mb in 1.2 seconds.

Suspicion: This is a raw file, and we have allocated a buffer, and copied the whole file.

We have an open issue #992 to improve our raw support. Additionally, I believe all the metadata in your image is Xmp. We have an open issue #941 to update our XMP code to Adobe's current XMPsdk. It may be that our performance on your file will improve when #941 is complete. #992 is scheduled for v0.26.

The Exiv2 project is currently in the release phase for v0.25 and neither #941 nor #992 are targeted for v0.25. However I have updated both #941 and #992 to be aware of this discussion and your file will get more attention when we deal with those issues.

RE: How open just metadata image - Added by Thaisa Correia almost 7 years ago

Thanks for the answer and attention to the problem.

We will wait the problem solution under discussion.

    (1-5/5)