473,769 Members | 6,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3031
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)

iD8DBQFAvT8rJd0 1MZaTXX0RAjOBAJ 4sg/Li7V4wnmk34ouUk tf/Ui5JBQCfaEjp
Gz9mDeMVrzZzLvD MocwoTLA=
=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
6576
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 FRICKIN' COOL!!! ***MAN*** that would save me a buttload of work and make my life sooooo much easier!" As opposed to minor differences of this feature here, that feature there. Variations on style are of no interest to me. I'm coming at this from a...
10
3691
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. Andrew dalke@dalkescientific.com
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.