📄 canonraw.pm
字号:
#------------------------------------------------------------------------------# File: CanonRaw.pm## Description: Definitions for Canon CRW file information## Revisions: 11/25/2003 - P. Harvey Created# 12/02/2003 - P. Harvey Completely reworked and figured out many# more tags# 01/19/2004 - P. Harvey Added CleanRaw()#------------------------------------------------------------------------------package TagTables::CanonRaw;use strict;use vars qw($VERSION);use ExifTool qw{SetByteOrder Get16u Get32u};$VERSION = '1.00';sub ProcessRawDir($$$$);# Canon raw file tag table %TagTables::CanonRaw::Main = ( 0x0032 => 'CanonColorInfo1', 0x0805 => 'CanonFileDescription', 0x080a => { Name => 'CanonRawMakeModel', SubDirectory => { TagTable => 'TagTables::CanonRaw::MakeModel', }, }, 0x080b => 'CanonFirmwareVersion', 0x0810 => 'OwnerName', 0x0815 => 'CanonFileType', 0x0816 => 'OriginalFileName', 0x0817 => 'ThumbnailFileName', 0x102a => { Name => 'CanonShotInfo', SubDirectory => { TagTable => 'TagTables::Canon::ShotInfo', }, }, 0x102c => 'CanonColorInfo2', 0x102d => { Name => 'CanonCameraSettings', SubDirectory => { TagTable => 'TagTables::Canon::CameraSettings', }, }, 0x1031 => { Name => 'RawImageSize', SubDirectory => { TagTable => 'TagTables::CanonRaw::ImageSize', }, }, 0x1033 => { Name => 'CanonCustomFunctions10D', SubDirectory => { TagTable => 'TagTables::CanonCustom::Functions10D', }, }, 0x1038 => { Name => 'CanonPictureInfo', SubDirectory => { TagTable => 'TagTables::Canon::PictureInfo', }, }, 0x10a9 => { Name => 'WhiteBalanceTable', SubDirectory => { TagTable => 'TagTables::CanonRaw::WhiteBalance', }, }, 0x10b4 => { Name => 'ColorSpace', ValueConv => 'Get16u(\$val,0)', PrintConv => { 1 => 'sRGB', 2 => 'Adobe RGB', 0xffff => 'Uncalibrated', }, }, 0x180e => { Name => 'CanonRawDateData', SubDirectory => { TagTable => 'TagTables::CanonRaw::DateData', }, }, 0x1810 => { Name => 'CanonRawRotation', SubDirectory => { TagTable => 'TagTables::CanonRaw::Rotation', }, },# no useful information to print in this (large-ish) field# 0x1835 => {# Name => 'DecoderTable',# },# 0x2005 => {# Name => 'RawData',# }, 0x2007 => { Name => 'JpgFromRaw', PrintConv => '"(JPG in RAW file, use -b to extract binary)"', }, 0x5029 => { Name => 'FocalLength', ValueConv => '$val >> 16', PrintConv => 'sprintf("%.1fmm",$val)', }, 0x580b => { Name => 'SerialNumber', Description => 'Camera Body No.', PrintConv => 'sprintf("%.10d",$val)', }, 0x5817 => { Name => 'FileNumber', PrintConv => '$_=$val,s/(\d+)(\d=> {4},)/$1-$2/,$_', },);# Canon binary data blocks%TagTables::CanonRaw::MakeModel = ( TableType => 'BinaryData', Format => 'String', 0 => { Name => 'Make', Format => 'String[5]', }, 6 => { Name => 'Model', Format => 'String[32]', Description => 'Camera Model Name', ValueConv => '$_=$val,s/\0.*/\0/,$_', # remove junk at end of string },);%TagTables::CanonRaw::DateData = ( TableType => 'BinaryData', 0 => { Name => 'DateTimeOriginal', Format => 'ULong', Description => 'Shooting Date/Time', ValueConv => 'TagTables::CanonRaw::ConvertBinaryDate($val)', PrintConv => 'ExifTool::ConvertExifDate($val)', },);%TagTables::CanonRaw::ImageSize = ( TableType => 'BinaryData', Format => 'Short', 1 => 'ImageWidth', 2 => 'ImageHeight',);%TagTables::CanonRaw::Rotation = ( TableType => 'BinaryData', 6 => 'Rotation',);# these values are potentially useful to users of dcraw...%TagTables::CanonRaw::WhiteBalance = ( TableType => 'BinaryData', 1 => { Name => 'RedBalanceAuto', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 3 => { Name => 'BlueBalanceAuto', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 5 => { Name => 'RedBalanceDaylight', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 7 => { Name => 'BlueBalanceDaylight', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 9 => { Name => 'RedBalanceCloudy', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 11 => { Name => 'BlueBalanceCloudy', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 13 => { Name => 'RedBalanceTungsten', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 15 => { Name => 'BlueBalanceTungsten', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 17 => { Name => 'RedBalanceFluorescent', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 19 => { Name => 'BlueBalanceFluorescent', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 21 => { Name => 'RedBalanceFlash', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 23 => { Name => 'BlueBalanceFlash', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 25 => { Name => 'RedBalanceCustom', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 27 => { Name => 'BlueBalanceCustom', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 29 => { Name => 'RedBalanceB&W', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 31 => { Name => 'BlueBalanceB&W', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 33 => { Name => 'RedBalanceShade', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', }, 35 => { Name => 'BlueBalanceShade', Format => 'ShortRational', PrintConv => 'sprintf("%.5f",$val);', },);#------------------------------------------------------------------------------# Convert binary date to string# Inputs: 0) Long date valuesub ConvertBinaryDate($){ my $time = shift; my @time = gmtime($time); return sprintf("%4d:%.2d:%.2d %.2d:%.2d:%.2d", $time[5]+1900,$time[4]+1,$time[3], $time[2],$time[1],$time[0]);}#------------------------------------------------------------------------------# Do the work for CleanRaw()# Inputs: I'm not gonna tell because you shouldn't call this routine# Notes: This routine should be called only from CleanRaw() belowsub _doCleanRaw($$$$$$){ my $infile = shift; my $outfile = shift; my $in_place = shift; my $inref = shift; my $outref = shift; my $outJpgLen = shift; my ($buff, $sig, $mainDir); my ($jpgLen, $jpgPtr); my ($pk16, $pk32); open(RAW,$infile) or return 6;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -