📄 tiff.pm
字号:
package Image::TIFF;
# Copyright 1999-2001, Gisle Aas.
#
# This library is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
use strict;
use vars qw($VERSION);
$VERSION = '1.00';
my @types = (
undef,
[ "BYTE", "C1", 1],
[ "ASCII", "A1", 1],
[ "SHORT", "n1", 2],
[ "LONG", "N1", 4],
[ "RATIONAL", "N2", 8],
[ "SBYTE", "c1", 1],
[ "UNDEFINED", "a1", 1],
[ "SSHORT", "n1", 2],
[ "SLONG", "N1", 4],
[ "SRATIONAL", "N2", 8],
[ "FLOAT", "f1", 4], # XXX 4-byte IEEE format
[ "DOUBLE", "d1", 8], # XXX 8-byte IEEE format
);
my %nikon1_tags = (
0x0003 => "Quality",
0x0004 => "ColorMode",
0x0005 => "ImageAdjustment",
0x0006 => "CCDSensitivity",
0x0007 => "Whitebalance",
0x0008 => "Focus",
0x000A => "DigitalZoom",
0x000B => "Converter",
);
my %nikon2_tags = (
0x0002 => "ISOSetting",
0x0003 => "ColorMode",
0x0004 => "Quality",
0x0005 => "Whitebalance",
0x0006 => "ImageSharpening",
0x0007 => "FocusMode",
0x0008 => "FlashSetting",
0x000F => "ISOSelection",
0x0080 => "ImageAdjustment",
0x0082 => "AuxiliaryLens",
0x0085 => "ManualFocusDistance",
0x0086 => "DigitalZoom",
0x0088 => { __TAG__ => "AFFocusPosition",
pack("xCxx",0) => "Center",
pack("xCxx",1) => "Top",
pack("xCxx",2) => "Bottom",
pack("xCxx",3) => "Left",
pack("xCxx",4) => "Right",
},
0x0010 => "DataDump",
);
my %olympus_tags = (
0x0200 => "SpecialMode",
0x0201 => { __TAG__ => "JpegQual", 1 => "SQ", 2 => "HQ", 3 => "SHQ" },
0x0202 => { __TAG__ => "Macro", 0 => "Normal", 1 => "Macro" },
0x0204 => "DigiZoom",
0x0207 => "SoftwareRelease",
0x0208 => "PictInfo",
0x0209 => "CameraID",
0x0f00 => "DataDump",
);
my %fujifilm_tags = (
0x0000 => "Version",
0x1000 => "Quality",
0x1001 => { __TAG__ => "Sharpness",
1 => "Very Soft",
2 => "Soft",
3 => "Normal",
4 => "Hard",
5 => "Very Hard",
},
0x1002 => { __TAG__ => "WhiteBalance",
0 => "Auto",
256 => "Daylight",
512 => "Cloudy",
768 => "DaylightColor-fluorescence",
769 => "DaywhiteColor-fluorescence",
770 => "White-fluorescence",
1024 => "Incandenscense",
3840 => "Custom white balance",
},
0x1003 => { __TAG__ => "Color", 0 => "Normal", 256 => "High", 512 => "Low" },
0x1004 => { __TAG__ => "Tone" , 0 => "Normal", 256 => "High", 512 => "Low" },
0x1010 => { __TAG__ => "FlashMode", 0 => "Auto", 1 => "On", 2 => "Off", 3 => "Red-eye reduction" },
0x1011 => "FlashStrength",
0x1020 => { __TAG__ => "Macro", 0 => "Off", 1 => "On"},
0x1021 => { __TAG__ => "FocusMode", 0 => "Auto", 1 => "Manual" },
0x1030 => { __TAG__ => "SlowSync", 0 => "Off", 1 => "On"},
0x1031 => { __TAG__ => "PictureMode",
0 => "Auto",
1 => "Portrait",
2 => "Landscape",
4 => "Sports",
5 => "Night",
6 => "Program AE",
256 => "Aperture priority",
512 => "Shutter priority",
768 => "Manual",
},
0x1100 => { __TAG__ => "AutoBracketing", 0 => "Off", 1 => "On"},
0x1300 => { __TAG__ => "BlurWarning", 0 => "No", 1 => "Yes"},
0x1301 => { __TAG__ => "FocusWarning", 0 => "No", 1 => "Yes"},
0x1302 => { __TAG__ => "AEWarning", 0 => "No", 1 => "Yes"},
);
my %casio_tags = (
0x0001 => { __TAG__ => "RecordingMode",
1 => "SingleShutter",
2 => "Panorama",
3 => "Night scene",
4 => "Portrait",
5 => "Landscape",
},
0x0002 => { __TAG__ => "Quality", 1 => "Economy", 2 => "Normal", 3 => "Fine" },
0x0003 => { __TAG__ => "FocusingMode",
2 => "Macro",
3 => "Auto",
4 => "Manual",
5 => "Infinity",
},
0x0004 => { __TAG__ => "FlashMode", 1 => "Auto", 2 => "On", 3 => "Off", 4 => "Red-eye reduction" },
0x0005 => { __TAG__ => "FlashIntensity", 11 => "Weak", 13 => "Normal", 15 => "Strong" },
0x0006 => "ObjectDistance",
0x0007 => { __TAG__ => "WhiteBalance",
1 => "Auto",
2 => "Tungsten",
3 => "Daylight",
4 => "Fluorescent",
5 => "Shade",
129 => "Manual",
},
0x000a => { __TAG__ => "DigitalZoom", 65536 => "Off", 65537 => "2X" },
0x000b => { __TAG__ => "Sharpness", 0 => "Normal", 1 => "Soft", 2 => "Hard" },
0x000c => { __TAG__ => "Contrast" , 0 => "Normal", 1 => "Low", 2 => "High" },
0x000d => { __TAG__ => "Saturation", 0 => "Normal", 1 => "Low", 2 => "High" },
0x0014 => { __TAG__ => "CCDSensitivity",
64 => "Normal",
125 => "+1.0",
250 => "+2.0",
244 => "+3.0",
80 => "Normal",
100 => "High",
},
);
my %makernotes = (
"NIKON E700" => [8, 'CoolPix', \%nikon1_tags],
"NIKON E800" => [8, 'CoolPix', \%nikon1_tags],
"NIKON E900" => [8, 'CoolPix', \%nikon1_tags],
"NIKON E900S" => [8, 'CoolPix', \%nikon1_tags],
"NIKON E910" => [8, 'CoolPix', \%nikon1_tags],
"NIKON E950" => [8, 'CoolPix', \%nikon1_tags],
"NIKON E880" => [0, 'CoolPix', \%nikon2_tags],
"NIKON E990" => [0, 'CoolPix', \%nikon2_tags],
"NIKON E995" => [0, 'CoolPix', \%nikon2_tags],
"NIKON CORPORATION NIKON D1" => [0, 'NikonD1', \%nikon2_tags],
"OLYMPUS OPTICAL CO.,LTD C2000Z" => [8, 'Olympus', \%olympus_tags],
"OLYMPUS OPTICAL CO.,LTD C2100UZ" => [8, 'Olympus', \%olympus_tags],
"OLYMPUS OPTICAL CO.,LTD C2500L" => [8, 'Olympus', \%olympus_tags],
"OLYMPUS OPTICAL CO.,LTD C3030Z" => [8, 'Olympus', \%olympus_tags],
"OLYMPUS OPTICAL CO.,LTD C3040Z" => [8, 'Olympus', \%olympus_tags],
"OLYMPUS OPTICAL CO.,LTD E-10" => [8, 'Olympus', \%olympus_tags],
"FUJIFILM FinePix4900ZOOM" => [-1, 'FinePix', \%fujifilm_tags],
"FUJIFILM FinePix6900ZOOM" => [-1, 'FinePix', \%fujifilm_tags],
"FUJIFILM FinePix40i" => [-1, 'FinePix', \%fujifilm_tags],
"FUJIFILM FinePix4700 ZOOM" => [-1, 'FinePix', \%fujifilm_tags],
"FUJIFILM FinePixS1Pro" => [-1, 'FinePix', \%fujifilm_tags],
"CASIO QV-3000EX" => [0, 'Casio', \%casio_tags],
"Canon Canon EOS D30" => [0, 'Canon', {}],
"Canon Canon EOS D60" => [0, 'Canon', {}],
"Canon Canon DIGITAL IXUS" => [0, 'Canon', {}],
"Canon Canon DIGITAL IXUS 300" => [0, 'Canon', {}],
"Canon Canon PowerShot G1" => [0, 'Canon', {}],
"Canon Canon PowerShot Pro90 IS" => [0, 'Canon', {}],
"Canon Canon PowerShot S10" => [0, 'Canon', {}],
"Canon Canon PowerShot S20" => [0, 'Canon', {}],
);
my %exif_intr_tags = (
0x1 => "InteroperabilityIndex",
0x2 => "InteroperabilityVersion",
0x1000 => "RelatedImageFileFormat",
0x1001 => "RelatedImageWidth",
0x1002 => "RelatedImageLength",
);
# Tag decode helpers
sub components_configuration_decoder;
sub file_source_decoder;
sub scene_type_decoder;
my %exif_tags = (
0x828D => "CFARepeatPatternDim",
0x828E => "CFAPattern",
0x828F => "BatteryLevel",
0x8298 => "Copyright",
0x829A => "ExposureTime",
0x829D => "FNumber",
0x83BB => "IPTC/NAA",
0x8769 => "ExifOffset",
0x8773 => "InterColorProfile",
0x8822 => { __TAG__ => "ExposureProgram",
1 => "Manual",
2 => "Program",
3 => "Aperture priority",
4 => "Shutter priority",
5 => "Program creative",
6 => "Program action",
7 => "Portrait",
8 => "Landscape",
},
0x8824 => "SpectralSensitivity",
0x8825 => "GPSInfo",
0x8827 => "ISOSpeedRatings",
0x8828 => "OECF",
0x9000 => "ExifVersion",
0x9003 => "DateTimeOriginal",
0x9004 => "DateTimeDigitized",
0x9101 => { __TAG__ => "ComponentsConfiguration",
DECODER => \&components_configuration_decoder,
},
0x9102 => "CompressedBitsPerPixel",
0x9201 => "ShutterSpeedValue",
0x9202 => "ApertureValue",
0x9203 => "BrightnessValue",
0x9204 => "ExposureBiasValue",
0x9205 => "MaxApertureValue",
0x9206 => "SubjectDistance",
0x9207 => { __TAG__ => "MeteringMode",
1 => "Average",
2 => "Center weighted average",
3 => "Spot",
4 => "Multi-spot",
5 => "Multi-segment",
},
0x9208 => { __TAG__ => "LightSource",
0 => "Auto",
1 => "Daylight",
2 => "Fluorescent",
3 => "Tungsten",
10 => "Flash",
},
0x9209 => { __TAG__ => "Flash",
0 => "No",
1 => "Yes",
},
0x920A => "FocalLength",
0x927C => "MakerNote",
0x9286 => "UserComment",
0x9290 => "SubSecTime",
0x9291 => "SubSecTimeOriginal",
0x9292 => "SubSecTimeDigitized",
0xA000 => "FlashPixVersion",
0xA001 => "ColorSpace",
0xA002 => "ExifImageWidth",
0xA003 => "ExifImageLength",
0xA005 => {__TAG__ => "InteroperabilityOffset",
__SUBIFD__ => \%exif_intr_tags,
},
0xA20B => "FlashEnergy", # 0x920B in TIFF/EP
0xA20C => "SpatialFrequencyResponse", # 0x920C - -
0xA20E => "FocalPlaneXResolution", # 0x920E - -
0xA20F => "FocalPlaneYResolution", # 0x920F - -
0xA210 => { __TAG__ => "FocalPlaneResolutionUnit", # 0x9210 - -
1 => "dpi",
2 => "dpm",
3 => "dpcm",
4 => "dpmm",
5 => "dp祄",
},
0xA214 => "SubjectLocation", # 0x9214 - -
0xA215 => "ExposureIndex", # 0x9215 - -
0xA217 => "SensingMethod", # 0x9217 - -
0xA300 => {__TAG__ => "FileSource",
DECODER => \&file_source_decoder,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -