Image::MetaData::JPEG 0.15 review
DownloadImage::MetaData::JPEG is a Perl extension for showing/modifying JPEG (meta)data. SYNOPSIS use Image::MetaData::JPEG;
|
|
Image::MetaData::JPEG is a Perl extension for showing/modifying JPEG (meta)data.
SYNOPSIS
use Image::MetaData::JPEG;
# Create a new JPEG file structure object
my $image = new Image::MetaData::JPEG('somepicture.jpg');
die 'Error: ' . Image::MetaData::JPEG::Error() unless $image;
# Get a list of references to comment segments
my @segments = $image->get_segments('COM', 'INDEXES');
# Get the JPEG picture dimensions
my ($dim_x, $dim_y) = $image->get_dimensions();
# Show all JPEG segments and their content
print $image->get_description();
# Retrieve a specific value from Exif meta-data
my $image_data = $image->get_Exif_data('IMAGE_DATA', 'TEXTUAL');
print $image_data->{DateTimeOriginal}->[0], "n";
# Modify the DateTime tag for the main image
$image->set_Exif_data({'DateTime' => '1994:07:23 12:14:51'},
'IMAGE_DATA', 'ADD');
# Delete all meta-data segments (please, don't)
$image->drop_segments('METADATA');
# Rewrite file to disk after your modifications
$image->save('new_file_name.jpg');
# ... and a lot more methods for viewing/modifying meta-data, which
# are accessed through the $file or $segments[$index] references.
The purpose of this module is to read/modify/rewrite meta-data segments in JPEG (Joint Photographic Experts Group format) 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 (tagged data blocks), and the actual row picture 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 instead 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. See the appendix about the structure of JPEG files for technical details.
This module works by breaking a JPEG file into individual segments. Each file is associated to an Image::MetaData::JPEG structure object, which contains one Image::MetaData::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.
$JPEG::show_warnings
This package variable must be used to inhibit the printing of warnings: if it is false, warnings are silently ignored. Otherwise, warning messages come with a detailed back-trace and description of the warning location.
$Image::MetaData::JPEG::show_warnings = undef;
Requirements:
Perl
Image::MetaData::JPEG 0.15 keywords