Image-MetaData-JPEG

 view release on metacpan or  search on metacpan

lib/Image/MetaData/JPEG/data/Tables.pm  view on Meta::CPAN

 0x040c => ['ThumbnailResource2',       ' ', 0, 65535, 'binary'           ], #
 0x040d => ['GlobalAngle',              ' ', 0, 65535, 'binary'           ], #
 0x040e => ['ColorSamplersResource',    ' ', 0, 65535, 'binary'           ], #
 0x040f => ['ICCProfile',               ' ', 0, 65535, 'binary'           ], #
 0x0410 => ['Watermark',                ' ', 0, 65535, 'binary'           ], #
 0x0411 => ['ICCUntagged',              ' ', 0, 65535, 'binary'           ], #
 0x0412 => ['EffectsVisible',           ' ', 0, 65535, 'binary'           ], #
 0x0413 => ['SpotHalftone',             ' ', 0, 65535, 'binary'           ], #
 0x0414 => ['IDsBaseValue',             ' ', 0, 65535, 'binary'           ], #
 0x0415 => ['UnicodeAlphaNames',        ' ', 0, 65535, 'binary'           ], #
 0x0416 => ['IndexedColourTableCount',  ' ', 0, 65535, 'binary'           ], #
 0x0417 => ['TransparentIndex',         ' ', 0, 65535, 'binary'           ], #
 0x0419 => ['GlobalAltitude',           ' ', 0, 65535, 'binary'           ], #
 0x041a => ['Slices',                   ' ', 0, 65535, 'binary'           ], #
 0x041b => ['WorkflowURL',              ' ', 0, 65535, 'binary'           ], #
 0x041c => ['JumpToXPEP',               ' ', 0, 65535, 'binary'           ], #
 0x041d => ['AlphaIdentifiers',         ' ', 0, 65535, 'binary'           ], #
 0x041e => ['URLList',                  ' ', 0, 65535, 'binary'           ], #
 0x0421 => ['VersionInfo',              ' ', 0, 65535, 'binary'           ], #
 0x2710 => ['PrintFlagsInfo',           ' ', 0, 65535, 'binary'        ], }; #
#----------------------------------------------------------------------------#
@$HASH_PHOTOSHOP_GENERAL{keys %$HASH_PHOTOSHOP_PATHINFO} =                   #
    values %$HASH_PHOTOSHOP_PATHINFO;                                        #
#============================================================================#
#============================================================================#
#============================================================================#
# Some scalar-valued hashes, which were once original databases, are now     #
# generated with "generate_lookup" from more general array-valued hashes     #
# (in practice, a single column is singled out from a multi-column table).   #
# %$HASH_APP1_IFD is built by merging the first column of 3 different hashes.#
#----------------------------------------------------------------------------#
my $HASH_PHOTOSHOP_TAGS  = generate_lookup($HASH_PHOTOSHOP_GENERAL     ,0);  #
my $HASH_PHOTOSHOP_PHUT  = generate_lookup($HASH_PHOTOSHOP_PATHINFO    ,0);  #
my $HASH_IPTC_TAGS_1     = generate_lookup($HASH_IPTC_GENERAL_1        ,0);  #
my $HASH_IPTC_TAGS_2     = generate_lookup($HASH_IPTC_GENERAL_2        ,0);  #
my $HASH_APP1_ROOT       = generate_lookup($HASH_APP1_ROOT_GENERAL     ,0);  #
my $HASH_APP1_GPS        = generate_lookup($HASH_GPS_GENERAL           ,0);  #
my $HASH_APP1_INTEROP    = generate_lookup($HASH_INTEROP_GENERAL       ,0);  #
my $HASH_APP1_IFD        = generate_lookup($HASH_APP1_IFD01_GENERAL    ,0);  #
my $HASH_APP1_SUBIFD     = generate_lookup($HASH_APP1_SUBIFD_GENERAL   ,0);  #
#============================================================================#
#============================================================================#
#============================================================================#
# Some segments (APP1 and APP3 currently) have an IFD-like structure, i.e.   #
# they can have "subdirectories" pointed to by offset tags. These subdirs    #
# are bifurcation points for the lookup process, and are represented by      #
# hash references instead of plain strings (scalars).                        #
#----------------------------------------------------------------------------#
$$HASH_APP1_IFD{SubIFD}     = $HASH_APP1_SUBIFD;   # Exif private tags       #
$$HASH_APP1_IFD{GPS}        = $HASH_APP1_GPS;      # GPS tags                #
$$HASH_APP3_IFD{Special}    = $HASH_APP3_SPECIAL;  # Special effect tags     #
$$HASH_APP3_IFD{Borders}    = $HASH_APP3_BORDERS;  # Border tags             #
$$HASH_APP1_SUBIFD{Interop} = $HASH_APP1_INTEROP;  # Interoperability tags   #
#============================================================================#
#============================================================================#
#============================================================================#
# MakerNote stuff is stored in a separated file; the return value of this    #
# inclusion is the $HASH_MAKERNOTES hash reference, containing all relevant  #
# parameters. We only have to link this new table into $HASH_APP1_SUBIFD.    #
#----------------------------------------------------------------------------#
our $HASH_MAKERNOTES = require 'Image/MetaData/JPEG/data/Makernotes.pl';     #
$$HASH_APP1_SUBIFD{'MakerNoteData_' . $_} =                                  #
    generate_lookup($$HASH_MAKERNOTES{$_}{tags} ,0)                          #
    for keys %$HASH_MAKERNOTES;                                              #
#============================================================================#
#============================================================================#
#============================================================================#
# Syntax tables and mandatory records tables for IPTC data are hidden in the #
# corresponding tag hashes. Another %IFD_SUBDIRS is overkill here.           #
#----------------------------------------------------------------------------#
$$HASH_IPTC_TAGS_1{__syntax}    = $HASH_IPTC_GENERAL_1;                      #
$$HASH_IPTC_TAGS_1{__mandatory} = $HASH_IPTC_MANDATORY_1;                    #
$$HASH_IPTC_TAGS_2{__syntax}    = $HASH_IPTC_GENERAL_2;                      #
$$HASH_IPTC_TAGS_2{__mandatory} = $HASH_IPTC_MANDATORY_2;                    #
$$HASH_PHOTOSHOP_TAGS{__syntax} = $HASH_PHOTOSHOP_GENERAL;                   #
#============================================================================#
#============================================================================#
#============================================================================#
# The following hash is the database for the tag-to-tagname translation; of  #
# course, records with a textual tag are not listed here. The navigation     #
# through this structure is best done with the help of the JPEG_lookup       #
# function, so this hash is not exported (as it was some time ago).          #
#----------------------------------------------------------------------------#
my $psdirname = sub { $APP13_PHOTOSHOP_DIRNAME . '_' . $_[0] };              #
#----------------------------------------------------------------------------#
my $JPEG_RECORD_NAME =                                                       #
{APP1  => {%$HASH_APP1_ROOT,                                   # APP1 root   #
	   IFD0                     => $HASH_APP1_IFD,         # main image  #
	   IFD1                     => $HASH_APP1_IFD, },      # thumbnail   #
 APP2  => {TagTable                 => $HASH_APP2_ICC, },      # ICC data    #
 APP3  => {IFD0                     => $HASH_APP3_IFD, },      # main image  #
 APP13 => {&$psdirname('8BIM')      => $HASH_PHOTOSHOP_TAGS,   # PS:8BIM     #
	   &$psdirname('8BPS')      => $HASH_PHOTOSHOP_TAGS,   # PS: < ver 4 #
	   &$psdirname('PHUT')      => $HASH_PHOTOSHOP_PHUT,   # PS:PHUT     #
	   $APP13_IPTC_DIRNAME.'_1' => $HASH_IPTC_TAGS_1,      # PS:IPTC R:1 #
	   $APP13_IPTC_DIRNAME.'_2' => $HASH_IPTC_TAGS_2, }, };# PS:IPTC R:2 #
#----------------------------------------------------------------------------#

###########################################################
# This helper function returns record data from the       #
# %$JPEG_RECORD_NAME hash. The arguments are first joined #
# with the '@' character, and then splitted on the same   #
# character to give a list of '@'-free strings (this al-  #
# lows for greater flexibility at call time); this list   #
# contains keys for exploring the %$JPEG_RECORD_NAME hash;#
# e.g., the arguments ('APP1', 'IFD0@GPS', 0x1e) select   #
# $JPEG_RECORD_NAME{APP1}{IFD0}{GPS}{0x1e}, i.e. the      #
# textual name of the GPS record with key = 0x1e in the   #
# IFD0 in the APP1 segment. If, at some point during the  #
# search, an argument fails (it is not a valid key) or it #
# is not defined, the search is interrupted, and undef is #
# returned. Note also that the return value could be a    #
# string as well as a hash reference, depending on the    #
# search depth. If the key lookup for the last argument   #
# fails, a reverse lookup is run (i.e., the key corres-   #
# ponding to the value equal to the last user argument is #
# searched). If even this lookup fails, undef is returned.#
########################################################### 
sub JPEG_lookup {
    # all searches start from here
    my $lookup = $JPEG_RECORD_NAME;



( run in 2.187 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )