[Image-SIG] conflict between various library to process EXIF data
Bram Mertens
bram-mertens at linux.be
Sat Sep 26 17:05:25 CEST 2009
Hi,
How to read and write EXIF data from images has been discussed several
times before but I could not find a discussion on the problem I've run
into when using multiple of these.
In short: after adding a comment to the EXIF header using the
setComment(...) and writeMetadata(...) methods of pyeviv2
(http://tilloy.net/dev/pyexiv2/doc/release-0.1.2/pyexiv2.htm) the EXIF
header is altered in such a way that it is no longer possible to read
the EXIF header with EXIF.py.
Furthermore imghdr does not even recognize it as a JPEG anymore.
>>> import imghdr
>>> type = imghdr.what('DSC02299.JPG')
>>> print type
jpeg
>>> type = imghdr.what('20070623-171634-DSC-H5.jpg')
>>> print type
None
Also the file command in Linux no longer recognizes the EXIF header:
before:
$ file DSC02299.JPG
DSC02299.JPG: JPEG image data, EXIF standard 2.21
after:
$ file 20070623-171634-DSC-H5.jpg
20070623-171634-DSC-H5.jpg: JPEG image data
(Note: part of the processing done is to rename the image based on the
date in the EXIF header)
I switched from EXIF.py to pyexiv2 because the first does not provide a
method to add a comment to the header. Considering the fact that
EXIF.py appears to be no longer under active development I simply
replaced all my calls to EXIF.py with calls to the relevant pyexeiv2
methods. However imghdr is part of the standard library so the fact it
will not recognize the image anymore makes me wonder if maybe pyexiv2 is
doing something "wrong" that might cause other problems later on.
Can anybody provide insight into this?
Thanks in advance
Bram
More information about the Image-SIG
mailing list