[Image-SIG] Support for EXIF in PIL

Guillaume Sauzon drinegui at netscape.net
Tue Mar 23 15:06:54 EST 2004


Hello,

First of all, thank you to all for your answers.
I'm now actually using a mix of both solutions:
Using jpegtran to rotate my pictures (which kills the exif) and add 
again the exif with jhead.
Nice thing is that I can remove the exif thumbnail at the same time

Thank you again,

Guillaume

Chris.Barker at noaa.gov wrote:

>
>
> Guillaume Sauzon wrote:
>
>> I want to rotate on the fly some pictures. They are JPEG containing 
>> EXIF data. If I do it with PIL, I loose the EXIF header. I tried to 
>> reconstruct it in the end pictures, but it doesn't work. I guess JFIF 
>> and EXIF are somehow incompatible.
>> Is there a way to keep this header ?
>> Any ideas ?
>
>
> In addtion to this problem, if you use PIL to rotate a jpeg, it is 
> uncompressing and then re-compressing the jpeg. As jpeg is a lossy 
> format, you degrade the image a little by doing this.
>
> I'd suggest using one of the versions of jpegtools. Look for:
>
> jpegtran (lossless rotation of images)
> jpegcrop (the above, plus lossless cropping)
>
> They both can keep your EXIF data as well. One or both of these is 
> likely to be installed already on a Linux system, and I'm pretty sure 
> they are available for Windows and other systems as well.
>
> I'd love to wrap jpegcrop up and make a python tool out of it, but at 
> the moment, I'm just using it as a system call.
>
> -Chris
>
>
>
>




More information about the Image-SIG mailing list