Ignore:
Timestamp:
2011-06-01T12:33:42+12:00 (13 years ago)
Author:
sjm84
Message:

Updating the ExifTool perl modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Ricoh.pm

    r16842 r24107  
    1717use Image::ExifTool::Exif;
    1818
    19 $VERSION = '1.05';
     19$VERSION = '1.17';
    2020
    2121sub ProcessRicohText($$$);
    2222sub ProcessRicohRMETA($$$);
     23
     24# lens types for Ricoh GXR
     25my %ricohLensIDs = (
     26    Notes => q{
     27        Lens units available for the GXR, used by the Ricoh Composite LensID tag.  Note
     28        that unlike lenses for all other makes of cameras, the focal lengths in these
     29        model names have already been scaled to include the 35mm crop factor.
     30    },
     31    # (the exact lens model names used by Ricoh, except for a change in case)
     32    'RL1' => 'GR Lens A12 50mm F2.5 Macro',
     33    'RL2' => 'Ricoh Lens S10 24-70mm F2.5-4.4 VC',
     34    'RL3' => 'Ricoh Lens P10 28-300mm F3.5-5.6 VC',
     35    'RL5' => 'GR Lens A12 28mm F2.5',
     36);
    2337
    2438%Image::ExifTool::Ricoh::Main = (
     
    2741    CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
    2842    WRITABLE => 1,
    29     NOTES => 'These tags are used by Ricoh Caplio camera models.',
    30     0x0001 => { Name => 'MakerNoteType',    Writable => 'string' },
    31     0x0002 => { Name => 'MakerNoteVersion', Writable => 'string' },
     43    0x0001 => { Name => 'MakerNoteType',   Writable => 'string' },
     44    0x0002 => { #PH
     45        Name => 'FirmwareVersion',
     46        Writable => 'string',
     47        # ie. "Rev0113" is firmware version 1.13
     48        PrintConv => '$val=~/^Rev(\d+)$/ ? sprintf("%.2f",$1/100) : $val',
     49        PrintConvInv => '$val=~/^(\d+)\.(\d+)$/ ? sprintf("Rev%.2d%.2d",$1,$2) : $val',
     50    },
     51    0x0005 => [ #PH
     52        {
     53            Condition => '$$valPt =~ /^[-\w ]+$/',
     54            Name => 'SerialNumber', # (verified for GXR)
     55            Writable => 'undef',
     56            Count => 16,
     57            Notes => q{
     58                the serial number stamped on the camera begins with 2 model-specific letters
     59                followed by the last 8 digits of this value.  For the GXR, this is the
     60                serial number of the lens unit
     61            },
     62            PrintConv => '$val=~s/^(.*)(.{8})$/($1)$2/; $val',
     63            PrintConvInv => '$val=~tr/()//d; $val',
     64        },{
     65            Name => 'InternalSerialNumber',
     66            Writable => 'undef',
     67            Count => 16,
     68            PrintConv => 'unpack("H*", $val)',
     69            PrintConvInv => 'pack("H*", $val)',
     70        },
     71    ],
    3272    0x0e00 => {
    3373        Name => 'PrintIM',
    3474        Writable => 0,
    3575        Description => 'Print Image Matching',
    36         SubDirectory => {
    37             TagTable => 'Image::ExifTool::PrintIM::Main',
    38         },
     76        SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' },
    3977    },
    4078    0x1001 => {
    4179        Name => 'ImageInfo',
    42         SubDirectory => {
    43             TagTable => 'Image::ExifTool::Ricoh::ImageInfo',
    44         },
     80        SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::ImageInfo' },
    4581    },
    4682    0x1003 => {
     
    5692        {
    5793            Name => 'RicohSubdir',
    58             Condition => '$self->{CameraModel} !~ /^Caplio RR1\b/',
     94            Condition => '$self->{Model} !~ /^Caplio RR1\b/',
    5995            SubDirectory => {
    6096                Validate => '$val =~ /^\[Ricoh Camera Info\]/',
     
    119155        DataTag => 'PreviewImage',
    120156        Protected => 2,
     157        # prevent preview from being written to raw images
     158        RawConvInv => q{
     159            return $val if $$self{FILE_TYPE} eq "JPEG";
     160            warn "Can't write PreviewImage to $$self{TIFF_TYPE} file\n";
     161            return undef;
     162        },
    121163    },
    122164    30 => {
     
    126168        DataTag => 'PreviewImage',
    127169        Protected => 2,
     170        RawConvInv => q{
     171            return $val if $$self{FILE_TYPE} eq "JPEG";
     172            warn "\n"; # suppress warning (already issued for PreviewImageStart)
     173            return undef;
     174        },
    128175    },
    129176    32 => {
     
    155202            3 => 'Tungsten',
    156203            4 => 'Fluorescent',
    157             # 5 (One Pushes, flake setting?)
    158             # 7 (details setting?)
     204            5 => 'Manual', #PH (GXR)
     205            7 => 'Detail',
     206            9 => 'Multi-pattern Auto', #PH (GXR)
    159207        },
    160208    },
     
    169217            7 => 800,
    170218            8 => 1600,
     219            9 => 'Auto', #PH (? CX3)
    171220        },
    172221    },
     
    177226            1 => 'Normal',
    178227            2 => 'Low',
    179             3 => 'None (B&W)',
    180         },
    181     },
    182 );
    183 
     228            3 => 'B&W',
     229            6 => 'Toning Effect', #PH (GXR Sepia,Red,Green,Blue,Purple)
     230            9 => 'Vivid', #PH (GXR)
     231            10 => 'Natural', #PH (GXR)
     232        },
     233    },
     234);
     235
     236# Ricoh subdirectory tags (ref PH)
    184237# NOTE: this subdir is not currently writable because the offsets would require
    185238# special code to handle the funny start location and base offset
     
    188241    WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
    189242    CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
    190     0x0004 => { Name => 'RicohDateTime1', Groups => { 2 => 'Time' } }, #PH
    191     0x0005 => { Name => 'RicohDateTime2', Groups => { 2 => 'Time' } }, #PH
    192     # 0x000E ProductionNumber? (ref 2)
     243    # the significance of the following 2 dates is not known.  They are usually
     244    # within a month of each other, but I have seen differences of nearly a year.
     245    # Sometimes the first is more recent, and sometimes the second.
     246    0x0004 => { # (NC)
     247        Name => 'ManufactureDate1',
     248        Groups => { 2 => 'Time' },
     249        Writable => 'string',
     250        Count => 20,
     251    },
     252    0x0005 => { # (NC)
     253        Name => 'ManufactureDate2',
     254        Groups => { 2 => 'Time' },
     255        Writable => 'string',
     256        Count => 20,
     257    },
     258    # 0x000c - int32u[2] 1st number is a counter (file number? shutter count?) - PH
     259    # 0x0014 - int8u[338] - could contain some data related to face detection? - PH
     260    # 0x0015 - int8u[2]: related to noise reduction?
     261    0x001a => { #PH
     262        Name => 'FaceInfo',
     263        SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::FaceInfo' },
     264    },
     265    0x0029 => {
     266        Name => 'FirmwareInfo',
     267        SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::FirmwareInfo' },
     268    },
     269    0x002a => {
     270        Name => 'NoiseReduction',
     271        # this is the applied value if NR is set to "Auto"
     272        Writable => 'int32u',
     273        PrintConv => {
     274            0 => 'Off',
     275            1 => 'Weak',
     276            2 => 'Strong',
     277            3 => 'Max',
     278        },
     279    },
     280    0x002c => { # (GXR)
     281        Name => 'SerialInfo',
     282        SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::SerialInfo' },
     283    }
     284    # 0x000E ProductionNumber? (ref 2) [no. zero for most models - PH]
     285);
     286
     287# face detection information (ref PH, CX4)
     288%Image::ExifTool::Ricoh::FaceInfo = (
     289    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     290    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     291    WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
     292    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     293    WRITABLE => 1,
     294    FIRST_ENTRY => 0,
     295    DATAMEMBER => [ 181 ],
     296    0xb5 => { # (should be int16u at 0xb4?)
     297        Name => 'FacesDetected',
     298        DataMember => 'FacesDetected',
     299        RawConv => '$$self{FacesDetected} = $val',
     300    },
     301    0xb6 => {
     302        Name => 'FaceDetectFrameSize',
     303        Format => 'int16u[2]',
     304    },
     305    0xbc => {
     306        Name => 'Face1Position',
     307        Condition => '$$self{FacesDetected} >= 1',
     308        Format => 'int16u[4]',
     309        Notes => q{
     310            left, top, width and height of detected face in coordinates of
     311            FaceDetectFrameSize with increasing Y downwards
     312        },
     313    },
     314    0xc8 => {
     315        Name => 'Face2Position',
     316        Condition => '$$self{FacesDetected} >= 2',
     317        Format => 'int16u[4]',
     318    },
     319    0xd4 => {
     320        Name => 'Face3Position',
     321        Condition => '$$self{FacesDetected} >= 3',
     322        Format => 'int16u[4]',
     323    },
     324    0xe0 => {
     325        Name => 'Face4Position',
     326        Condition => '$$self{FacesDetected} >= 4',
     327        Format => 'int16u[4]',
     328    },
     329    0xec => {
     330        Name => 'Face5Position',
     331        Condition => '$$self{FacesDetected} >= 5',
     332        Format => 'int16u[4]',
     333    },
     334    0xf8 => {
     335        Name => 'Face6Position',
     336        Condition => '$$self{FacesDetected} >= 6',
     337        Format => 'int16u[4]',
     338    },
     339    0x104 => {
     340        Name => 'Face7Position',
     341        Condition => '$$self{FacesDetected} >= 7',
     342        Format => 'int16u[4]',
     343    },
     344    0x110 => {
     345        Name => 'Face8Position',
     346        Condition => '$$self{FacesDetected} >= 8',
     347        Format => 'int16u[4]',
     348    },
     349);
     350
     351# firmware version information (ref PH)
     352%Image::ExifTool::Ricoh::FirmwareInfo = (
     353    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     354    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     355    WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
     356    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     357    WRITABLE => 1,
     358    0x00 => {
     359        Name => 'FirmwareRevision',
     360        Format => 'string[12]',
     361    },
     362    0x0c => {
     363        Name => 'FirmwareRevision2',
     364        Format => 'string[12]',
     365    },
     366);
     367
     368# serial/version number information written by GXR (ref PH)
     369%Image::ExifTool::Ricoh::SerialInfo = (
     370    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     371    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     372    WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
     373    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     374    WRITABLE => 1,
     375    NOTES => 'This information is found in images from the GXR.',
     376    0 => {
     377        Name => 'BodyFirmware', #(NC)
     378        Format => 'string[16]',
     379        # observed: "RS1 :V00560000" --> FirmwareVersion "Rev0056"
     380        #           "RS1 :V01020200" --> FirmwareVersion "Rev0102"
     381    },
     382    16 => {
     383        Name => 'BodySerialNumber',
     384        Format => 'string[16]',
     385        # observed: "SID:00100056" --> "WD00100056" on plate
     386    },
     387    32 => {
     388        Name => 'LensFirmware', #(NC)
     389        Format => 'string[16]',
     390        # observed: "RL1 :V00560000", "RL1 :V01020200" - A12 50mm F2.5 Macro
     391        #           "RL2 :V00560000", "RL2 :V01020300" - S10 24-70mm F2.5-4.4 VC
     392        # --> used in a Composite tag to determine LensType
     393    },
     394    48 => {
     395        Name => 'LensSerialNumber',
     396        Format => 'string[16]',
     397        # observed: (S10) "LID:00010024" --> "WF00010024" on plate
     398        #           (A12) "LID:00010054" --> "WE00010029" on plate??
     399    },
    193400);
    194401
     
    198405    PROCESS_PROC => \&ProcessRicohText,
    199406    NOTES => q{
    200         Ricoh RDC models such as the RDC-i700, RDC-5000, RDC-6000, RDC-7 and
    201         RDC-4300 use a text-based format for their maker notes instead of the IFD
    202         format used by the Caplio models.  Below is a list of known tags in this
    203         information.
    204     },
    205     Rev => 'Revision',
    206     Rv => 'Revision',
     407        Some Ricoh DC and RDC models use a text-based format for their maker notes
     408        instead of the IFD format used by the Caplio models.  Below is a list of known
     409        tags in this information.
     410    },
     411    Rev => {
     412        Name => 'FirmwareVersion',
     413        PrintConv => '$val=~/^\d+$/ ? sprintf("%.2f",$val/100) : $val',
     414        PrintConvInv => '$val=~/^(\d+)\.(\d+)$/ ? sprintf("%.2d%.2d",$1,$2) : $val',
     415    },
     416    Rv => {
     417        Name => 'FirmwareVersion',
     418        PrintConv => '$val=~/^\d+$/ ? sprintf("%.2f",$val/100) : $val',
     419        PrintConvInv => '$val=~/^(\d+)\.(\d+)$/ ? sprintf("%.2d%.2d",$1,$2) : $val',
     420    },
    207421    Rg => 'RedGain',
    208422    Gg => 'GreenGain',
     
    259473);
    260474
     475# information stored in Ricoh AVI images (ref PH)
     476%Image::ExifTool::Ricoh::AVI = (
     477    GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
     478    ucmt => {
     479        Name => 'Comment',
     480        # Ricoh writes a "Unicode" header even when text is ASCII (spaces anyway)
     481        ValueConv => '$_=$val; s/^(Unicode\0|ASCII\0\0\0)//; tr/\0//d; s/\s+$//; $_',
     482    },
     483    mnrt => {
     484        Name => 'MakerNoteRicoh',
     485        SubDirectory => {
     486            TagTable => 'Image::ExifTool::Ricoh::Main',
     487            Start => '$valuePtr + 8',
     488            ByteOrder => 'BigEndian',
     489            Base => '8',
     490        },
     491    },
     492    rdc2 => {
     493        Name => 'RicohRDC2',
     494        Unknown => 1,
     495        ValueConv => 'unpack("H*",$val)',
     496        # have seen values like 0a000444 and 00000000 - PH
     497    },
     498    thum => {
     499        Name => 'ThumbnailImage',
     500        Binary => 1,
     501    },
     502);
     503
     504# Ricoh composite tags
     505%Image::ExifTool::Ricoh::Composite = (
     506    GROUPS => { 2 => 'Camera' },
     507    LensID => {
     508        SeparateTable => 'Ricoh LensID',
     509        Require => 'Ricoh:LensFirmware',
     510        RawConv => '$val[0] ? $val[0] : undef',
     511        ValueConv => '$val=~s/\s*:.*//; $val',
     512        PrintConv => \%ricohLensIDs,
     513    },
     514);
     515
     516# add our composite tags
     517Image::ExifTool::AddCompositeTags('Image::ExifTool::Ricoh');
     518
     519
    261520#------------------------------------------------------------------------------
    262521# Process Ricoh text-based maker notes
     
    281540        return 0;
    282541    }
    283     my $pos = 0;
    284542    while ($data =~ m/([A-Z][a-z]{1,2})([0-9A-F]+);/sg) {
    285543        my $tag = $1;
     
    419677=head1 AUTHOR
    420678
    421 Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
     679Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
    422680
    423681This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.