Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > conflict between various library to process EXIF data

Thread Tools

conflict between various library to process EXIF data

Bram Mertens
Posts: n/a

I posted this to [Image-SIG] a while ago but did not got a reply so I
assume it may not have been the appropriate list. If this is again
not the right list please direct me to the proper list.

How to read and write EXIF data from images has been discussed several
times on the [Image-SIG] list 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
( the EXIF
header is altered in such a way that it is no longer possible to read
the EXIF header with
Furthermore imghdr does not even recognize it as a JPEG anymore.

>>> import imghdr
>>> type = imghdr.what('DSC02299.JPG')
>>> print type

>>> type = imghdr.what('20070623-171634-DSC-H5.jpg')
>>> print type


Also the file command in Linux no longer recognizes the EXIF header:
$ file DSC02299.JPG
DSC02299.JPG: JPEG image data, EXIF standard 2.21
$ 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 to pyexiv2 because the first does not provide
a method to add a comment to the header. Considering the fact that appears to be no longer under active development I simply
replaced all my calls to 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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Various ways to get month name from inbuilt C library santosh C Programming 5 03-11-2010 11:34 AM
css conflict (or html conflict) charles cashion HTML 2 02-18-2009 09:41 PM
Processing Images: Need good library for various image formats polemon C++ 4 07-22-2007 09:35 AM
How to swap plugins/extensions between 2 computer / various version of Mozilla Firefox? Chaos Master Firefox 0 07-10-2004 05:00 AM
Difference between various functions SDZ C Programming 18 06-16-2004 06:22 AM