Speno's Pythonic Avocado 29.12.2003

2003-12-29

Reading JPEG comments with the Python Imaging Library

I needed to read comments from JPEG files for a photo gallery project application I wrote. I used the Python Imaging Library (PIL), which needed a small modification to support JPEG comments. Since a few people have asked for the diffs over the years, I'll post them here.

A patch to support reading JPEG comments for the Python Imaging Library.

Once your PIL is patched, you can access a JPEG's comments like so:

from PIL import Image jpeg = Image.open('example.jpg') comment = jpeg.info.get('comment', '') print 'Jpeg comments: ', comment

Take care.

posted at 14:05:36    #    comment []    trackback []
December 2003
MoTuWeThFrSaSu
1 2 3 4 5 6 7
8 91011121314
15161718192021
22232425262728
293031    
Nov
2003
 Jan
2004

One python programmer's search for understanding and avocados. This isn't personal, only pythonic.

XML-Image Letterimage

© 2003-2005, John P. Speno