Any Python modules for manipulating JFIF file contents?

Jeff Epler jepler at unpythonic.net
Wed Jun 2 04:44:59 CEST 2004


PIL can extract information like resolution.

exifdump.py and EXIF.py can read the "EXIF" data that accompanies many
photos taken on digital cameras.  This can include a thumbnail,
information like exposure time and focal length, and on some cameras it
even tells you the orientation of the camera when the picture was taken.
These two programs don't have any external requirements, they parse the
JFIF and EXIF structures in pure Python.

There are also Python wrappers for imlib and imagemagick, two other
(unix) libraries often seen for image manipulation.  I used imlib long
ago, but I've never used imagemagick.

My online photo albums (http://photos.unpy.net) use python with image
metadata stored in a postgres database and the images themselves stored
on the filesystem.  It uses exifdump.py to read EXIF information.  The
source code to this is too nasty for me to consider sharing it with the
world.

More recently, I've been writing an image viewer in pygame, with the
primary goal to reduce how often the user waits for a response.  For
instance, when the program is idle it preloads and scales the
next/previous image in the image sequence.  This has been fun (and I'm
glad I learned pygame) but a user madly pressing "next" on an 800MHz
machine can always get ahead of the computer trying to load 6 megapixel
photos!  To make things worse, PIL doesn't seem to release the GIL
during long operations (such as loading a JPEG image or scaling it, each
of which can take 2 seconds), and lacks progress callbacks (let alone a
way to abort one of these operations in progress)...

Have fun with your project!

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040601/0be11fe2/attachment.pgp>


More information about the Python-list mailing list