S
Stefano Bettelli
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
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