~berthold-daum/zora/trunk

« back to all changes in this revision

Viewing changes to com.bdaum.zoom.batch.unix/exiftool/lib/Image/ExifTool/Exif.pm

  • Committer: bdaum
  • Date: 2015-12-26 10:21:51 UTC
  • Revision ID: berthold.daum@bdaum.de-20151226102151-44f1j5113167thb9
VersionĀ 2.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
use Image::ExifTool qw(:DataAccess :Utils);
53
53
use Image::ExifTool::MakerNotes;
54
54
 
55
 
$VERSION = '3.72';
 
55
$VERSION = '3.77';
56
56
 
57
57
sub ProcessExif($$$);
58
58
sub WriteExif($$$);
569
569
    0x11d => 'PageName',
570
570
    0x11e => 'XPosition',
571
571
    0x11f => 'YPosition',
 
572
    # FreeOffsets/FreeByteCounts are used by Ricoh for RMETA information
 
573
    # in TIFF images (not yet supported)
572
574
    0x120 => {
573
575
        Name => 'FreeOffsets',
574
576
        IsOffset => 1,
1152
1154
        },
1153
1155
    },
1154
1156
    0x4749 => 'RatingPercent', #PH
 
1157
    0x7035 => 'ChromaticAberrationCorrParams', #forum6509 (Sony A7 ARW)
 
1158
    0x7037 => 'DistortionCorrParams', #forum6509 (Sony A7 ARW)
1155
1159
    0x800d => 'ImageID', #10
1156
1160
    0x80a3 => { Name => 'WangTag1', Binary => 1 }, #20
1157
1161
    0x80a4 => { Name => 'WangAnnotation', Binary => 1 },
3111
3115
            7 => 'LensFocalRange',
3112
3116
            8 => 'LensSpec',
3113
3117
            9 => 'LensType2',
 
3118
            10 => 'LensFocalLength', # (for Pentax to check for converter)
3114
3119
        },
3115
3120
        Notes => q{
3116
3121
            attempt to identify the actual lens from all lenses with a given LensType.
3133
3138
                $prt[0] = $prt[9];
3134
3139
                $pcv = $$self{TAG_INFO}{LensType2}{PrintConv};
3135
3140
            }
3136
 
            Image::ExifTool::Exif::PrintLensID($self, $prt[0], $pcv, $prt[8], @val);
 
3141
            my $lens = Image::ExifTool::Exif::PrintLensID($self, $prt[0], $pcv, $prt[8], @val);
 
3142
            # check for use of lens converter (Pentax K-3)
 
3143
            if ($val[10] and $val[1] and $lens) {
 
3144
                my $conv = $val[1] / $val[10];
 
3145
                $lens .= sprintf(' + %.1fx converter', $conv) if $conv > 1.1;
 
3146
            }
 
3147
            return $lens;
3137
3148
        },
3138
3149
    },
3139
3150
);
3573
3584
    my ($et, $lensTypePrt, $printConv, $lensSpecPrt, $lensType, $focalLength,
3574
3585
        $maxAperture, $maxApertureValue, $shortFocal, $longFocal, $lensModel,
3575
3586
        $lensFocalRange, $lensSpec) = @_;
3576
 
    # the rest of the logic relies on the LensType lookup:
 
3587
    # this logic relies on the LensType lookup:
3577
3588
    return undef unless defined $lensType;
3578
3589
    # get print conversion hash if necessary
3579
3590
    $printConv or $printConv = $$et{TAG_INFO}{LensType}{PrintConv};
3602
3613
        ($shortFocal, $longFocal) = ($1, $2 || $1);
3603
3614
    }
3604
3615
    if ($$et{Make} eq 'SONY') {
3605
 
        if (($lensType & 0xff00) == 0xef00) {
3606
 
            # patch for Metabones Canon adapter on a Sony camera (ref Jos Roost)
3607
 
            # (note: the adapter kills the high byte for 2-byte LensType values,
3608
 
            # so the reported lens will be incorrect for these)
3609
 
            require Image::ExifTool::Canon;
3610
 
            $printConv = \%Image::ExifTool::Canon::canonLensTypes;
3611
 
            $lensType &= 0xff;
3612
 
            $lensTypePrt = $$printConv{$lensType} if $$printConv{$lensType};
 
3616
        # patch for Metabones Canon adapters on Sony cameras (ref Jos Roost)
 
3617
        # (the Metabones adapters add 0xef00 or 0x7700 to the high byte
 
3618
        # for 2-byte LensType values, so we need to adjust for these)
 
3619
        if ($lensType != 0xffff) {
 
3620
            require Image::ExifTool::Minolta;
 
3621
            if ($Image::ExifTool::Minolta::metabonesID{$lensType & 0xff00}) {
 
3622
                $lensType -= ($lensType >= 0xef00 ? 0xef00 : $lensType >= 0xbc00 ? 0xbc00 : 0x7700);
 
3623
                require Image::ExifTool::Canon;
 
3624
                $printConv = \%Image::ExifTool::Canon::canonLensTypes;
 
3625
                $lensTypePrt = $$printConv{$lensType} if $$printConv{$lensType};
 
3626
            }
3613
3627
        }
3614
3628
    } elsif ($shortFocal and $longFocal) {
3615
3629
        # Canon (and some other makes) include makernote information
3642
3656
        if ($sf0) {
3643
3657
            next if abs($sf - $sf0) > 0.5 or abs($sa - $sa0) > 0.15 or
3644
3658
                    abs($lf - $lf0) > 0.5 or abs($la - $la0) > 0.15;
3645
 
            # the basic parameters match, but also check against additional lens features
3646
 
            # for Sony E lenses -- the full LensSpec string should match with end of LensType
3647
 
            $lensSpecPrt and $lens =~ /\Q$lensSpecPrt\E( \(|$)/ and @best = ( $lens ), last;
3648
 
            # exactly-matching Sony E lens should have been found above, so skip
3649
 
            # any not-exactly-matching Sony E-lenses
3650
 
            next if $lens =~ /^Sony E /;
3651
 
            push @best, $lens;
 
3659
            # the basic parameters match, but also check against additional lens features:
 
3660
            # for Sony A and E lenses, the full LensSpec string should match with end of LensType,
 
3661
            # excluding any part between () at the end, and preceded by a space (the space
 
3662
            # ensures that e.g. Zeiss Loxia 21mm having LensSpec "E 21mm F2.8" will not be
 
3663
            # identified as "Sony FE 21mm F2.8 (SEL28F20 + SEL075UWC)")
 
3664
            $lensSpecPrt and $lens =~ / \Q$lensSpecPrt\E( \(|$)/ and @best = ( $lens ), last;
 
3665
            # exactly-matching Sony lens should have been found above, so only add non-Sony lenses
 
3666
            push @best, $lens unless $lens =~ /^Sony /;
3652
3667
            next;
3653
3668
        }
3654
3669
        # adjust focal length and aperture if teleconverter is attached (Minolta)
3694
3709
        }
3695
3710
        push @matches, $lens;
3696
3711
    }
 
3712
    # return the user-defined lens if it exists
3697
3713
    if (@user) {
3698
3714
        # choose the best match if we have more than one
3699
3715
        if (@user > 1) {
3705
3721
        }
3706
3722
        return join(' or ', @user);
3707
3723
    }
 
3724
    # return the best match(es) from the possible lenses
3708
3725
    return join(' or ', @best) if @best;
3709
3726
    return join(' or ', @matches) if @matches;
3710
3727
    $lens = $$printConv{$lensType};
3946
3963
                $et->Warn("Bad format ($format) for $name entry $index", $inMakerNotes);
3947
3964
                ++$warnCount;
3948
3965
            }
3949
 
            return 0 unless $index; # assume corrupted IFD if this is our first entry
 
3966
            # assume corrupted IFD if this is our first entry (except Sony ILCE-7M2 firmware 1.21)
 
3967
            return 0 unless $index or $$et{Model} eq 'ILCE-7M2';
3950
3968
            next;
3951
3969
        }
3952
3970
        my $formatStr = $formatName[$format];   # get name of this format
4488
4506
                $val = shift @values;           # continue with next subdir
4489
4507
            }
4490
4508
            my $doMaker = $et->Options('MakerNotes');
4491
 
            next unless $doMaker or $$et{REQ_TAG_LOOKUP}{lc($tagStr)} or
4492
 
                        $$tagInfo{BlockExtract};
 
4509
            next unless $doMaker or $$et{REQ_TAG_LOOKUP}{lc($tagStr)} or $$tagInfo{BlockExtract};
4493
4510
            # extract as a block if specified
4494
4511
            if ($$tagInfo{MakerNotes}) {
4495
4512
                # save maker note byte order (if it was significant and valid)