| 1 | #------------------------------------------------------------------------------ | ||||||||||
| 2 | # File: Shortcuts.pm | ||||||||||
| 3 | # | ||||||||||
| 4 | # Description: ExifTool shortcut tags | ||||||||||
| 5 | # | ||||||||||
| 6 | # Revisions: 02/07/2004 - PH Moved out of Exif.pm | ||||||||||
| 7 | # 09/15/2004 - PH Added D70Boring from Greg Troxel | ||||||||||
| 8 | # 01/11/2005 - PH Added Canon20D from Christian Koller | ||||||||||
| 9 | # 03/03/2005 - PH Added user defined shortcuts | ||||||||||
| 10 | # 03/26/2005 - PH Added Nikon from Tom Christiansen | ||||||||||
| 11 | # 02/28/2007 - PH Removed model-dependent shortcuts | ||||||||||
| 12 | # --> this is what UserDefined::Shortcuts is for | ||||||||||
| 13 | # 02/25/2009 - PH Added Unsafe | ||||||||||
| 14 | # 07/03/2010 - PH Added CommonIFD0 | ||||||||||
| 15 | #------------------------------------------------------------------------------ | ||||||||||
| 16 | |||||||||||
| 17 | package Image::ExifTool::Shortcuts; | ||||||||||
| 18 | |||||||||||
| 19 | 53 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 53 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 53 | $VERSION = '1.69'; | |||||||||
| 23 | |||||||||||
| 24 | # this is a special table used to define command-line shortcuts | ||||||||||
| 25 | # (documentation Notes may be added for these via %shortcutNotes in BuildTagLookup.pm) | ||||||||||
| 26 | 53 | %Image::ExifTool::Shortcuts::Main = ( | |||||||||
| 27 | # this shortcut allows the three common date/time tags to be shifted at once | ||||||||||
| 28 | AllDates => [ | ||||||||||
| 29 | 'DateTimeOriginal', | ||||||||||
| 30 | 'CreateDate', | ||||||||||
| 31 | 'ModifyDate', | ||||||||||
| 32 | ], | ||||||||||
| 33 | # This is a shortcut to some common information which is useful in most images | ||||||||||
| 34 | Common => [ | ||||||||||
| 35 | 'FileName', | ||||||||||
| 36 | 'FileSize', | ||||||||||
| 37 | 'Model', | ||||||||||
| 38 | 'DateTimeOriginal', | ||||||||||
| 39 | 'ImageSize', | ||||||||||
| 40 | 'Quality', | ||||||||||
| 41 | 'FocalLength', | ||||||||||
| 42 | 'ShutterSpeed', | ||||||||||
| 43 | 'Aperture', | ||||||||||
| 44 | 'ISO', | ||||||||||
| 45 | 'WhiteBalance', | ||||||||||
| 46 | 'Flash', | ||||||||||
| 47 | ], | ||||||||||
| 48 | # This shortcut provides the same information as the Canon utilities | ||||||||||
| 49 | Canon => [ | ||||||||||
| 50 | 'FileName', | ||||||||||
| 51 | 'Model', | ||||||||||
| 52 | 'DateTimeOriginal', | ||||||||||
| 53 | 'ShootingMode', | ||||||||||
| 54 | 'ShutterSpeed', | ||||||||||
| 55 | 'Aperture', | ||||||||||
| 56 | 'MeteringMode', | ||||||||||
| 57 | 'ExposureCompensation', | ||||||||||
| 58 | 'ISO', | ||||||||||
| 59 | 'Lens', | ||||||||||
| 60 | 'FocalLength', | ||||||||||
| 61 | 'ImageSize', | ||||||||||
| 62 | 'Quality', | ||||||||||
| 63 | 'Flash', | ||||||||||
| 64 | 'FlashType', | ||||||||||
| 65 | 'ConditionalFEC', | ||||||||||
| 66 | 'RedEyeReduction', | ||||||||||
| 67 | 'ShutterCurtainHack', | ||||||||||
| 68 | 'WhiteBalance', | ||||||||||
| 69 | 'FocusMode', | ||||||||||
| 70 | 'Contrast', | ||||||||||
| 71 | 'Sharpness', | ||||||||||
| 72 | 'Saturation', | ||||||||||
| 73 | 'ColorTone', | ||||||||||
| 74 | 'ColorSpace', | ||||||||||
| 75 | 'LongExposureNoiseReduction', | ||||||||||
| 76 | 'FileSize', | ||||||||||
| 77 | 'FileNumber', | ||||||||||
| 78 | 'DriveMode', | ||||||||||
| 79 | 'OwnerName', | ||||||||||
| 80 | 'SerialNumber', | ||||||||||
| 81 | ], | ||||||||||
| 82 | Nikon => [ | ||||||||||
| 83 | 'Model', | ||||||||||
| 84 | 'SubSecDateTimeOriginal', | ||||||||||
| 85 | 'ShutterCount', | ||||||||||
| 86 | 'LensSpec', | ||||||||||
| 87 | 'FocalLength', | ||||||||||
| 88 | 'ImageSize', | ||||||||||
| 89 | 'ShutterSpeed', | ||||||||||
| 90 | 'Aperture', | ||||||||||
| 91 | 'ISO', | ||||||||||
| 92 | 'NoiseReduction', | ||||||||||
| 93 | 'ExposureProgram', | ||||||||||
| 94 | 'ExposureCompensation', | ||||||||||
| 95 | 'WhiteBalance', | ||||||||||
| 96 | 'WhiteBalanceFineTune', | ||||||||||
| 97 | 'ShootingMode', | ||||||||||
| 98 | 'Quality', | ||||||||||
| 99 | 'MeteringMode', | ||||||||||
| 100 | 'FocusMode', | ||||||||||
| 101 | 'ImageOptimization', | ||||||||||
| 102 | 'ToneComp', | ||||||||||
| 103 | 'ColorHue', | ||||||||||
| 104 | 'ColorSpace', | ||||||||||
| 105 | 'HueAdjustment', | ||||||||||
| 106 | 'Saturation', | ||||||||||
| 107 | 'Sharpness', | ||||||||||
| 108 | 'Flash', | ||||||||||
| 109 | 'FlashMode', | ||||||||||
| 110 | 'FlashExposureComp', | ||||||||||
| 111 | ], | ||||||||||
| 112 | # This shortcut may be useful when copying tags between files to either | ||||||||||
| 113 | # copy the maker notes as a block or prevent it from being copied | ||||||||||
| 114 | MakerNotes => [ | ||||||||||
| 115 | 'MakerNotes', # (for RIFF MakerNotes) | ||||||||||
| 116 | 'MakerNoteApple', | ||||||||||
| 117 | 'MakerNoteCanon', | ||||||||||
| 118 | 'MakerNoteCasio', | ||||||||||
| 119 | 'MakerNoteCasio2', | ||||||||||
| 120 | 'MakerNoteDJI', | ||||||||||
| 121 | 'MakerNoteDJIInfo', | ||||||||||
| 122 | 'MakerNoteFLIR', | ||||||||||
| 123 | 'MakerNoteFujiFilm', | ||||||||||
| 124 | 'MakerNoteGE', | ||||||||||
| 125 | 'MakerNoteGE2', | ||||||||||
| 126 | 'MakerNoteGoogle', | ||||||||||
| 127 | 'MakerNoteHasselblad', | ||||||||||
| 128 | 'MakerNoteHP', | ||||||||||
| 129 | 'MakerNoteHP2', | ||||||||||
| 130 | 'MakerNoteHP4', | ||||||||||
| 131 | 'MakerNoteHP6', | ||||||||||
| 132 | 'MakerNoteISL', | ||||||||||
| 133 | 'MakerNoteJVC', | ||||||||||
| 134 | 'MakerNoteJVCText', | ||||||||||
| 135 | 'MakerNoteKodak1a', | ||||||||||
| 136 | 'MakerNoteKodak1b', | ||||||||||
| 137 | 'MakerNoteKodak2', | ||||||||||
| 138 | 'MakerNoteKodak3', | ||||||||||
| 139 | 'MakerNoteKodak4', | ||||||||||
| 140 | 'MakerNoteKodak5', | ||||||||||
| 141 | 'MakerNoteKodak6a', | ||||||||||
| 142 | 'MakerNoteKodak6b', | ||||||||||
| 143 | 'MakerNoteKodak7', | ||||||||||
| 144 | 'MakerNoteKodak8a', | ||||||||||
| 145 | 'MakerNoteKodak8b', | ||||||||||
| 146 | 'MakerNoteKodak8c', | ||||||||||
| 147 | 'MakerNoteKodak9', | ||||||||||
| 148 | 'MakerNoteKodak10', | ||||||||||
| 149 | 'MakerNoteKodak11', | ||||||||||
| 150 | 'MakerNoteKodak12', | ||||||||||
| 151 | 'MakerNoteKodakUnknown', | ||||||||||
| 152 | 'MakerNoteKyocera', | ||||||||||
| 153 | 'MakerNoteMinolta', | ||||||||||
| 154 | 'MakerNoteMinolta2', | ||||||||||
| 155 | 'MakerNoteMinolta3', | ||||||||||
| 156 | 'MakerNoteMotorola', | ||||||||||
| 157 | 'MakerNoteNikon', | ||||||||||
| 158 | 'MakerNoteNikon2', | ||||||||||
| 159 | 'MakerNoteNikon3', | ||||||||||
| 160 | 'MakerNoteNintendo', | ||||||||||
| 161 | 'MakerNoteOlympus', | ||||||||||
| 162 | 'MakerNoteOlympus2', | ||||||||||
| 163 | 'MakerNoteOlympus3', | ||||||||||
| 164 | 'MakerNoteLeica', | ||||||||||
| 165 | 'MakerNoteLeica2', | ||||||||||
| 166 | 'MakerNoteLeica3', | ||||||||||
| 167 | 'MakerNoteLeica4', | ||||||||||
| 168 | 'MakerNoteLeica5', | ||||||||||
| 169 | 'MakerNoteLeica6', | ||||||||||
| 170 | 'MakerNoteLeica7', | ||||||||||
| 171 | 'MakerNoteLeica8', | ||||||||||
| 172 | 'MakerNoteLeica9', | ||||||||||
| 173 | 'MakerNoteLeica10', | ||||||||||
| 174 | 'MakerNotePanasonic', | ||||||||||
| 175 | 'MakerNotePanasonic2', | ||||||||||
| 176 | 'MakerNotePanasonic3', | ||||||||||
| 177 | 'MakerNotePentax', | ||||||||||
| 178 | 'MakerNotePentax2', | ||||||||||
| 179 | 'MakerNotePentax3', | ||||||||||
| 180 | 'MakerNotePentax4', | ||||||||||
| 181 | 'MakerNotePentax5', | ||||||||||
| 182 | 'MakerNotePentax6', | ||||||||||
| 183 | 'MakerNotePhaseOne', | ||||||||||
| 184 | 'MakerNoteReconyxHyperFire', | ||||||||||
| 185 | 'MakerNoteReconyxUltraFire', | ||||||||||
| 186 | 'MakerNoteReconyxHyperFire2', | ||||||||||
| 187 | 'MakerNoteReconyxMicroFire', | ||||||||||
| 188 | 'MakerNoteReconyxHyperFire4K', | ||||||||||
| 189 | 'MakerNoteRicohPentax', | ||||||||||
| 190 | 'MakerNoteRicoh', | ||||||||||
| 191 | 'MakerNoteRicoh2', | ||||||||||
| 192 | 'MakerNoteRicohText', | ||||||||||
| 193 | 'MakerNoteSamsung1a', | ||||||||||
| 194 | 'MakerNoteSamsung1b', | ||||||||||
| 195 | 'MakerNoteSamsung2', | ||||||||||
| 196 | 'MakerNoteSanyo', | ||||||||||
| 197 | 'MakerNoteSanyoC4', | ||||||||||
| 198 | 'MakerNoteSanyoPatch', | ||||||||||
| 199 | 'MakerNoteSigma', | ||||||||||
| 200 | 'MakerNoteSony', | ||||||||||
| 201 | 'MakerNoteSony2', | ||||||||||
| 202 | 'MakerNoteSony3', | ||||||||||
| 203 | 'MakerNoteSony4', | ||||||||||
| 204 | 'MakerNoteSony5', | ||||||||||
| 205 | 'MakerNoteSonyEricsson', | ||||||||||
| 206 | 'MakerNoteSonySRF', | ||||||||||
| 207 | 'MakerNoteUnknownText', | ||||||||||
| 208 | 'MakerNoteUnknownBinary', | ||||||||||
| 209 | 'MakerNoteUnknown', | ||||||||||
| 210 | ], | ||||||||||
| 211 | # "unsafe" tags we normally don't copy in JPEG images, defined | ||||||||||
| 212 | # as a shortcut to use when rebuilding JPEG EXIF from scratch | ||||||||||
| 213 | Unsafe => [ | ||||||||||
| 214 | 'IFD0:YCbCrPositioning', | ||||||||||
| 215 | 'IFD0:YCbCrCoefficients', | ||||||||||
| 216 | 'IFD0:TransferFunction', | ||||||||||
| 217 | 'ExifIFD:ComponentsConfiguration', | ||||||||||
| 218 | 'ExifIFD:CompressedBitsPerPixel', | ||||||||||
| 219 | 'InteropIFD:InteropIndex', | ||||||||||
| 220 | 'InteropIFD:InteropVersion', | ||||||||||
| 221 | 'InteropIFD:RelatedImageWidth', | ||||||||||
| 222 | 'InteropIFD:RelatedImageHeight', | ||||||||||
| 223 | ], | ||||||||||
| 224 | # standard tags used to define the color space of an image | ||||||||||
| 225 | # (useful to preserve color space when deleting all meta information) | ||||||||||
| 226 | ColorSpaceTags => [ | ||||||||||
| 227 | 'ExifIFD:ColorSpace', | ||||||||||
| 228 | 'ExifIFD:Gamma', | ||||||||||
| 229 | 'InteropIFD:InteropIndex', | ||||||||||
| 230 | 'ICC_Profile', | ||||||||||
| 231 | ], | ||||||||||
| 232 | # common metadata tags found in IFD0 of TIFF images | ||||||||||
| 233 | CommonIFD0 => [ | ||||||||||
| 234 | # standard EXIF | ||||||||||
| 235 | 'IFD0:ImageDescription', | ||||||||||
| 236 | 'IFD0:Make', | ||||||||||
| 237 | 'IFD0:Model', | ||||||||||
| 238 | 'IFD0:Software', | ||||||||||
| 239 | 'IFD0:ModifyDate', | ||||||||||
| 240 | 'IFD0:Artist', | ||||||||||
| 241 | 'IFD0:Copyright', | ||||||||||
| 242 | # other TIFF tags | ||||||||||
| 243 | 'IFD0:Rating', | ||||||||||
| 244 | 'IFD0:RatingPercent', | ||||||||||
| 245 | 'IFD0:DNGLensInfo', | ||||||||||
| 246 | 'IFD0:PanasonicTitle', | ||||||||||
| 247 | 'IFD0:PanasonicTitle2', | ||||||||||
| 248 | 'IFD0:XPTitle', | ||||||||||
| 249 | 'IFD0:XPComment', | ||||||||||
| 250 | 'IFD0:XPAuthor', | ||||||||||
| 251 | 'IFD0:XPKeywords', | ||||||||||
| 252 | 'IFD0:XPSubject', | ||||||||||
| 253 | ], | ||||||||||
| 254 | # large binary data tags which won't be loaded if excluded when extracting | ||||||||||
| 255 | LargeTags => [ | ||||||||||
| 256 | 'CanonVRD', | ||||||||||
| 257 | 'DLOData', | ||||||||||
| 258 | 'EXIF', | ||||||||||
| 259 | 'ICC_Profile', | ||||||||||
| 260 | 'IDCPreviewImage', | ||||||||||
| 261 | 'ImageData', | ||||||||||
| 262 | 'IPTC', | ||||||||||
| 263 | 'JpgFromRaw', | ||||||||||
| 264 | 'OriginalRawImage', | ||||||||||
| 265 | 'OtherImage', | ||||||||||
| 266 | 'PreviewImage', | ||||||||||
| 267 | 'ThumbnailImage', | ||||||||||
| 268 | 'TIFFPreview', | ||||||||||
| 269 | 'XML', | ||||||||||
| 270 | 'XMP', | ||||||||||
| 271 | 'ZoomedPreviewImage', | ||||||||||
| 272 | ], | ||||||||||
| 273 | 'ls-l' => [ | ||||||||||
| 274 | 'FilePermissions', | ||||||||||
| 275 | 'FileHardLinks', | ||||||||||
| 276 | 'FileUserID', | ||||||||||
| 277 | 'FileGroupID', | ||||||||||
| 278 | 'FileSize#', | ||||||||||
| 279 | 'FileModifyDate', | ||||||||||
| 280 | 'FileName', | ||||||||||
| 281 | ], | ||||||||||
| 282 | ImageDataMD5 => [ 'ImageDataHash' ], # (for backward compatibilty) | ||||||||||
| 283 | ); | ||||||||||
| 284 | |||||||||||
| 285 | #------------------------------------------------------------------------------ | ||||||||||
| 286 | # load user-defined shortcuts if available | ||||||||||
| 287 | # Inputs: reference to user-defined shortcut hash | ||||||||||
| 288 | sub LoadShortcuts($) | ||||||||||
| 289 | 0 | ▶ | { | ||||||||
|
Subroutine
LoadShortcuts: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 290 | 0 | my $shortcuts = shift; | |||||||||
| 291 | 0 | my $shortcut; | |||||||||
| 292 | 0 | foreach $shortcut (keys %$shortcuts) { | |||||||||
| 293 | 0 | my $val = $$shortcuts{$shortcut}; | |||||||||
| 294 | # also allow simple aliases | ||||||||||
| 295 | 0 | ▶ | $val = [ $val ] unless ref $val eq 'ARRAY'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 296 | # save the user-defined shortcut or alias | ||||||||||
| 297 | 0 | $Image::ExifTool::Shortcuts::Main{$shortcut} = $val; | |||||||||
| 298 | } | ||||||||||
| 299 | } | ||||||||||
| 300 | # (for backward compatibility, renamed in ExifTool 7.75) | ||||||||||
| 301 | 53 | ▶ | if (%Image::ExifTool::Shortcuts::UserDefined) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 302 | 0 | LoadShortcuts(\%Image::ExifTool::Shortcuts::UserDefined); | |||||||||
| 303 | } | ||||||||||
| 304 | 53 | ▶ | if (%Image::ExifTool::UserDefined::Shortcuts) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 305 | 0 | LoadShortcuts(\%Image::ExifTool::UserDefined::Shortcuts); | |||||||||
| 306 | } | ||||||||||
| 307 | |||||||||||
| 308 | |||||||||||
| 309 | 53 | 1; # end | |||||||||
| 310 | |||||||||||
| 311 | __END__ | ||||||||||