473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Any Python modules for manipulating JFIF file contents?

Warning: this post may display my utter ignorance of image file format
facts.

As part of a photo album program I'm working on, I'd like to be able
to work with the metadata in JPEG files, which I understand are
really JFIF files holding jpg data. Do any Python modules permit
me to do this? I looked at PIL, but it seemed to operatre at a
higher level, i.e. hiding the file-level implementation details.

At the least I'd like to be able to :

1) Extract the metadata (comments, thumbnails, etc)
2) Extract the raw JPEG data (since I want to experiment with
combining multiple images into a single 'album' file using
gdbm file.)

Writing would be nice, but is not necessary.

Failing a Python module, can anyone suggest the best library
to look at to wrap in a module?

Thanks,
Ken McDonald
Jul 18 '05 #1
1 3002
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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAvT8rJd01MZaTXX0RAjOBAJ4sg/Li7V4wnmk34ouUktf/Ui5JBQCfaEjp
Gz9mDeMVrzZzLvDMocwoTLA=
=swqX
-----END PGP SIGNATURE-----

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.