in reply to Re: Add a segment in a JPG image with Image::MetaData::JPEG
in thread Add a segment in a JPG image with Image::MetaData::JPEG
It does not matter if APP2 field descriptions are not supported. I only use your module to write chunks of data.use strict; use warnings; use Image::MetaData::JPEG; use Image::MetaData::JPEG::Record; use Image::MetaData::JPEG::data::Tables qw(:JPEGgrammar :Endianness :RecordTypes); #read the image filname from the command line arguments my $file = new Image::MetaData::JPEG($ARGV[0], 1); #create the APP2 segment, do not parse it as it is empty my $buffer; #the buffer that will contains the data to write in the s +egment my $segref = new Image::MetaData::JPEG::Segment('APP2', \$buffer, 'NOP +ARSE'); my $MP_FORMAT_IDENTIFIER = chr(hex '4D').chr(hex '50').chr(hex '46').c +hr(hex '00'); my $recref_mp_fid = $segref->store_record('MP_FORMAT_IDENTIFIER', $ASCII, \$MP_FORMAT_IDENTIFIER, 4); my $NEXT_IFD_OFFSET = chr(hex '42'). chr(hex '00'). chr(hex '00'). chr(hex '00'); my $next_ifd_offset = $segref->store_record('NEXT_IFD_OFFSET', $BYTE, \$NEXT_IFD_OFFSET, 4); #End of the MPIndex IFD ########################################## ########################################## #write all the records to the segment buffer $buffer = $recref_mp_fid->get(); # ... $buffer .= $next_ifd_offset->get();
|
|---|