Ignore:
Timestamp:
2021-02-26T19:39:51+13:00 (3 years ago)
Author:
anupama
Message:

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File:
1 edited

Legend:

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

    r24107 r34921  
    1212use vars qw($VERSION);
    1313use Image::ExifTool qw(:DataAccess :Utils);
    14 
    15 $VERSION = '1.02';
     14use Image::ExifTool::Exif;
     15
     16$VERSION = '1.08';
    1617
    1718# Sony IDC tags (ref PH)
     
    9293    0x8016 => { Name => 'SaturationAdj',        Writable => 'int32s' },
    9394    0x8017 => { Name => 'ContrastAdj',          Writable => 'int32s' },
    94     0x8018 => { Name => 'BrightnessAdj',        Writable => 'int32s' },
     95    0x8018 => {
     96        Name => 'BrightnessAdj',
     97        Writable => 'int32s',
     98        PrintConv => 'sprintf("%.2f", $val/300)', #JR
     99        PrintConvInv => '$val * 300',
     100    },
    95101    0x8019 => { Name => 'HueAdj',               Writable => 'int32s' },
    96102    0x801a => { Name => 'SharpnessAdj',         Writable => 'int32s' },
     
    152158    0x8031 => { Name => 'PeripheralIllumCentralValue',  Writable => 'int32s' },
    153159    0x8032 => { Name => 'PeripheralIllumPeriphValue',   Writable => 'int32s' },
     160    0x8040 => { #JR
     161        Name => 'DistortionCompensation',
     162        Writable => 'int32s',
     163        PrintConv => {
     164            -1 => 'n/a', # (fixed by lens)
     165            1 => 'On',
     166            2 => 'Off',
     167        },
     168    },
    154169    0x9000 => {
    155170        Name => 'ToneCurveBrightnessX',
     
    192207        Count => -1,
    193208    },
     209    0x900d => { #JR
     210        Name => 'ChromaticAberrationCorrection', # "Magnification Chromatic Aberration"
     211        Writable => 'int32s',
     212        PrintConv => { 1 => 'On', 2 => 'Off' },
     213    },
     214    0x900e => { #JR
     215        Name => 'InclinationCorrection',
     216        Writable => 'int32u',
     217        PrintConv => { 0 => 'Off', 1 => 'On' },
     218    },
     219    0x900f => { #JR
     220        Name => 'InclinationAngle',
     221        Writable => 'int32s',
     222        PrintConv => 'sprintf("%.1f deg", $val/1000)',
     223        PrintConvInv => 'ToFloat($val) * 1000',
     224    },
     225    0x9010 => { #JR
     226        Name => 'Cropping',
     227        Writable => 'int32u',
     228        PrintConv => { 0 => 'Off', 1 => 'On' },
     229    },
     230    0x9011 => { #JR
     231        Name => 'CropArea',
     232        Writable => 'int32u',
     233        Count => 4,
     234    },
     235    0x9012 => { #JR
     236        Name => 'PreviewImageSize',
     237        Writable => 'int32u',
     238        Count => 2,
     239    },
     240    0x9013 => { #JR (ARQ images)
     241        Name => 'PxShiftPeriphEdgeNR',
     242        Writable => 'int32s',
     243        PrintConv => { 0 => 'Off', 1 => 'On' },
     244    },
     245    0x9014 => { #JR (ARQ images)
     246        Name => 'PxShiftPeriphEdgeNRValue',
     247        Writable => 'int32s',
     248        PrintConv => 'sprintf("%.1f", $val/10)',
     249        PrintConvInv => '$val * 10',
     250    },
     251    0x9017 => { Name => 'WhitesAdj',        Writable => 'int32s' }, #JR
     252    0x9018 => { Name => 'BlacksAdj',        Writable => 'int32s' }, #JR
     253    0x9019 => { Name => 'HighlightsAdj',    Writable => 'int32s' }, #JR
     254    0x901a => { Name => 'ShadowsAdj',       Writable => 'int32s' }, #JR
    194255    0xd000 => { Name => 'CurrentVersion',   Writable => 'int32u' },
    195256    0xd001 => {
     
    230291    GROUPS => { 2 => 'Image' },
    231292    IDCPreviewImage => {
     293        Groups => { 2 => 'Preview' },
    232294        Require => {
    233295            0 => 'IDCPreviewStart',
     
    236298        # extract all preview images (not just one)
    237299        RawConv => q{
     300            @grps = $self->GetGroup($$val{0});
    238301            require Image::ExifTool::SonyIDC;
    239302            Image::ExifTool::SonyIDC::ExtractPreviews($self);
     
    260323sub ExtractPreviews($)
    261324{
    262     my $exifTool = shift;
     325    my $et = shift;
    263326    my $i = 1;
    264327    my $xtra = ' (1)';
     
    267330    for (;;) {
    268331        my $key = "IDCPreviewStart$xtra";
    269         unless (defined $$exifTool{VALUE}{$key}) {
     332        unless (defined $$et{VALUE}{$key}) {
    270333            last unless $xtra;
    271334            $xtra = ''; # do the last tag extracted last
     
    273336        }
    274337        # run through IDC preview images in the same order they were extracted
    275         my $off = $exifTool->GetValue($key) or last;
    276         my $len = $exifTool->GetValue("IDCPreviewLength$xtra") or last;
     338        my $off = $et->GetValue($key, 'ValueConv') or last;
     339        my $len = $et->GetValue("IDCPreviewLength$xtra", 'ValueConv') or last;
    277340        # get stack version from number in group 1 name
    278         my $grp1 = $exifTool->GetGroup($key, 1);
     341        my $grp1 = $et->GetGroup($key, 1);
    279342        if ($grp1 =~ /(\d+)$/) {
    280343            my $tag = "IDCPreviewImage$1";
    281344            unless ($Image::ExifTool::Extra{$tag}) {
    282                 Image::ExifTool::AddTagToTable(\%Image::ExifTool::Extra, $tag, {
     345                AddTagToTable(\%Image::ExifTool::Extra, $tag, {
    283346                    Name => $tag,
    284                     Groups => { 0 => 'Composite', 1 => 'Composite', 2 => 'Image'},
     347                    Groups => { 0 => 'Composite', 1 => 'Composite', 2 => 'Preview'},
    285348                });
    286349            }
    287             my $val = Image::ExifTool::Exif::ExtractImage($exifTool, $off, $len, $tag);
    288             $exifTool->FoundTag($tag, $val);
     350            my $val = Image::ExifTool::Exif::ExtractImage($et, $off, $len, $tag);
     351            $et->FoundTag($tag, $val, $et->GetGroup($key));
    289352        } else {
    290             $preview = Image::ExifTool::Exif::ExtractImage($exifTool, $off, $len, 'IDCPreviewImage');
     353            $preview = Image::ExifTool::Exif::ExtractImage($et, $off, $len, 'IDCPreviewImage');
    291354        }
    292355        # step to next set of tags unless we are done
     
    313376
    314377This module contains definitions required by Image::ExifTool to read and
    315 write Sony Image Data Converter verson 3.0 metadata in ARW images.
     378write Sony Image Data Converter version 3.0 metadata in ARW images.
    316379
    317380=head1 AUTHOR
    318381
    319 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     382Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    320383
    321384This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.