Request for comments on a JPEG metadata Perl module

From: Stefano Bettelli (stefano_bettelli_at_yahoo.fr)
Date: 06/26/04


Date: Sat, 26 Jun 2004 19:57:26 +0200

Hi,

I got recently interested in the possibility of designing a Perl
library for reading and modifying JPEG image metadata (with Exif
info, IPTC info, comments, thumbnails and so on). This kind of
additional data stored in the image itself is very useful for
organising digital photo collections. For various reasons, the
existing Perl libraries and programs do not fully satisfy me,
so I decided to enter the arena and write a Perl module (this is
also a good way to learn the language better ...).

I would like to ask you some suggestions
on how to design this module:

1) Do you think that submitting this module to CPAN is worth of,
   or do you think that what is available is already sufficient?
2) What is the best name for the module?
   I am currently using Image::MetaInfo::JPEG.
3) How can I decide what is the minimum Perl version
   for running the module?
4) Do you have any idea on how it could be extended? Whether
   there are interesting functionalities I did not think about?
   Do you have any suggestion on code style?

Every other suggestion is of course welcome. You can download
(FOR THE TIME BEING, let's say for next two weeks) the module
at the following address:

        http://82.229.136.165/IMJ/

In the following I am listing the main functionalities supplied
by my module. The purpose of this module is to read/modify/
rewrite meta-data segments in JPEG files, which can contain
comments, thumbnails, Exif information (photographic parameters),
IPTC information (editorial parameters) and similar data.

Each JPEG file is made of consecutive segments (data blocks
prefixed by a 2 byte segment code and a 2 byte segment length),
exception made for the actual picture data (the so called entropy
coded segment(s), which are indeed row data). Most of these
segments specify parameters for decoding the picture data into a
bitmap; some of them, namely the COMment and APPlication segments,
contain however meta-data, i.e., information about how the photo
was shot (usually added by a digital camera) and additional notes
from the photograph. These additional pieces of information are
especially valuable for picture databases, since the meta-data
can be saved together with the picture without resorting to
additional database structures.

This module works by breaking a JPEG file into individual segments.
Each file is associated to an Image::MetaInfo::JPEG structure
object, which contains one Image::MetaInfo::JPEG::Segment object
for each segment. Segments with a known format are then parsed,
and their content can be accessed in a structured way for display.
Some of them can even be modified and then rewritten to disk.

The current state is the following:

    Segment Possible content Status
    ------------------------------------------
    COM User comments parse/read/write
    APP0 JFIF data (+ thumbnail) parse/read
    APP1 Exif or XMP data parse
    APP2 FPXR data or ICC profiles parse
    APP3 additional EXIF-like data parse
    APP4 HPSC nothing
    APP12 PreExif ASCII meta parse[devel.]
    APP13 IPTC and PhotoShop data parse/read/(write IPTC [devel.])
    APP14 Adobe tags parse

"Parse" means that the segment content is decoded and stored
in low-level records. "Read" means that these data are available
in a more organised way at a higher level. The package contains
a quite detailed perldoc page, which you can read for further
info. This is the index:

   1) STRUCTURE OF JPEG PICTURES
   2) MANAGING A JPEG STRUCTURE OBJECT
   3) MANAGING A JPEG SEGMENT OBJECT
   4) MANAGING A JPEG RECORD OBJECT
   5) COMMENTS ("COM" segments)
   6) JFIF data ("APP0" segments)
   7) IPTC DATA (from "APP13" segments)
   8) CURRENT STATUS
   -) Known Problems
   -) References
   -) OTHER PACKAGES (the "competitors")

I plan to add read/write support for Exif data in a few weeks.
The module contains already a test suite with 67 tests.

Thank you in advance for every suggestions,
best regards,
                                Stefano Bettelli



Relevant Pages

  • Request for comments on a JPEG metadata Perl module
    ... I got recently interested in the possibility of designing a Perl ... library for reading and modifying JPEG image metadata (with Exif ... Each JPEG file is made of consecutive segments (data blocks ... exception made for the actual picture data (the so called entropy ...
    (comp.lang.perl.misc)
  • Command Button Prompt
    ... Our area of service is broken out into segments that we have color coded. ... I saved this map with color overlays as a jpeg, but would like to open it for reference out of the file ... I would like to have a command button open a map stored on my server as a Jpeg. ...
    (microsoft.public.access.forms)
  • Re: JPEG and Perl
    ... > I am new to perl ... > ALl want to do is to display a image on my html page using perl. ... Here, you start sending the client *text*, not a JPEG. ...
    (comp.lang.perl.misc)
  • Re: polylines
    ... tutorial relating to drawing polylines but couldn't find. ... If your software doesn't directly support polylines, ... simply draw the individual straight line segments. ... Stonehenge Perl Training ...
    (perl.beginners)
  • Re: decoding utf8
    ... that I need to decode and store in a flat file (it's a jpeg) from my perl socket application. ... I can't seem to find a way to have Perl decode it into it's byte representation. ...
    (comp.lang.perl.misc)