Shortcuts.pm 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. package Image::ExifTool::Shortcuts;
  17. use strict;
  18. use vars qw($VERSION);
  19. $VERSION = '1.57';
  20. # this is a special table used to define command-line shortcuts
  21. # (documentation Notes may be added for these via %shortcutNotes in BuildTagLookup.pm)
  22. %Image::ExifTool::Shortcuts::Main = (
  23. # this shortcut allows the three common date/time tags to be shifted at once
  24. AllDates => [
  25. 'DateTimeOriginal',
  26. 'CreateDate',
  27. 'ModifyDate',
  28. ],
  29. # This is a shortcut to some common information which is useful in most images
  30. Common => [
  31. 'FileName',
  32. 'FileSize',
  33. 'Model',
  34. 'DateTimeOriginal',
  35. 'ImageSize',
  36. 'Quality',
  37. 'FocalLength',
  38. 'ShutterSpeed',
  39. 'Aperture',
  40. 'ISO',
  41. 'WhiteBalance',
  42. 'Flash',
  43. ],
  44. # This shortcut provides the same information as the Canon utilities
  45. Canon => [
  46. 'FileName',
  47. 'Model',
  48. 'DateTimeOriginal',
  49. 'ShootingMode',
  50. 'ShutterSpeed',
  51. 'Aperture',
  52. 'MeteringMode',
  53. 'ExposureCompensation',
  54. 'ISO',
  55. 'Lens',
  56. 'FocalLength',
  57. 'ImageSize',
  58. 'Quality',
  59. 'Flash',
  60. 'FlashType',
  61. 'ConditionalFEC',
  62. 'RedEyeReduction',
  63. 'ShutterCurtainHack',
  64. 'WhiteBalance',
  65. 'FocusMode',
  66. 'Contrast',
  67. 'Sharpness',
  68. 'Saturation',
  69. 'ColorTone',
  70. 'ColorSpace',
  71. 'LongExposureNoiseReduction',
  72. 'FileSize',
  73. 'FileNumber',
  74. 'DriveMode',
  75. 'OwnerName',
  76. 'SerialNumber',
  77. ],
  78. Nikon => [
  79. 'Model',
  80. 'SubSecDateTimeOriginal',
  81. 'ShutterCount',
  82. 'LensSpec',
  83. 'FocalLength',
  84. 'ImageSize',
  85. 'ShutterSpeed',
  86. 'Aperture',
  87. 'ISO',
  88. 'NoiseReduction',
  89. 'ExposureProgram',
  90. 'ExposureCompensation',
  91. 'WhiteBalance',
  92. 'WhiteBalanceFineTune',
  93. 'ShootingMode',
  94. 'Quality',
  95. 'MeteringMode',
  96. 'FocusMode',
  97. 'ImageOptimization',
  98. 'ToneComp',
  99. 'ColorHue',
  100. 'ColorSpace',
  101. 'HueAdjustment',
  102. 'Saturation',
  103. 'Sharpness',
  104. 'Flash',
  105. 'FlashMode',
  106. 'FlashExposureComp',
  107. ],
  108. # This shortcut may be useful when copying tags between files to either
  109. # copy the maker notes as a block or prevent it from being copied
  110. MakerNotes => [
  111. 'MakerNotes', # (for RIFF MakerNotes)
  112. 'MakerNoteApple',
  113. 'MakerNoteCanon',
  114. 'MakerNoteCasio',
  115. 'MakerNoteCasio2',
  116. 'MakerNoteFLIR',
  117. 'MakerNoteFujiFilm',
  118. 'MakerNoteGE',
  119. 'MakerNoteGE2',
  120. 'MakerNoteHasselblad',
  121. 'MakerNoteHP',
  122. 'MakerNoteHP2',
  123. 'MakerNoteHP4',
  124. 'MakerNoteHP6',
  125. 'MakerNoteISL',
  126. 'MakerNoteJVC',
  127. 'MakerNoteJVCText',
  128. 'MakerNoteKodak1a',
  129. 'MakerNoteKodak1b',
  130. 'MakerNoteKodak2',
  131. 'MakerNoteKodak3',
  132. 'MakerNoteKodak4',
  133. 'MakerNoteKodak5',
  134. 'MakerNoteKodak6a',
  135. 'MakerNoteKodak6b',
  136. 'MakerNoteKodak7',
  137. 'MakerNoteKodak8a',
  138. 'MakerNoteKodak8b',
  139. 'MakerNoteKodak8c',
  140. 'MakerNoteKodak9',
  141. 'MakerNoteKodak10',
  142. 'MakerNoteKodak11',
  143. 'MakerNoteKodakUnknown',
  144. 'MakerNoteKyocera',
  145. 'MakerNoteMinolta',
  146. 'MakerNoteMinolta2',
  147. 'MakerNoteMinolta3',
  148. 'MakerNoteMotorola',
  149. 'MakerNoteNikon',
  150. 'MakerNoteNikon2',
  151. 'MakerNoteNikon3',
  152. 'MakerNoteNintendo',
  153. 'MakerNoteOlympus',
  154. 'MakerNoteOlympus2',
  155. 'MakerNoteLeica',
  156. 'MakerNoteLeica2',
  157. 'MakerNoteLeica3',
  158. 'MakerNoteLeica4',
  159. 'MakerNoteLeica5',
  160. 'MakerNoteLeica6',
  161. 'MakerNoteLeica7',
  162. 'MakerNoteLeica8',
  163. 'MakerNoteLeica9',
  164. 'MakerNotePanasonic',
  165. 'MakerNotePanasonic2',
  166. 'MakerNotePentax',
  167. 'MakerNotePentax2',
  168. 'MakerNotePentax3',
  169. 'MakerNotePentax4',
  170. 'MakerNotePentax5',
  171. 'MakerNotePentax6',
  172. 'MakerNotePhaseOne',
  173. 'MakerNoteReconyx',
  174. 'MakerNoteRicoh',
  175. 'MakerNoteRicoh2',
  176. 'MakerNoteRicohText',
  177. 'MakerNoteSamsung1a',
  178. 'MakerNoteSamsung1b',
  179. 'MakerNoteSamsung2',
  180. 'MakerNoteSanyo',
  181. 'MakerNoteSanyoC4',
  182. 'MakerNoteSanyoPatch',
  183. 'MakerNoteSigma',
  184. 'MakerNoteSony',
  185. 'MakerNoteSony2',
  186. 'MakerNoteSony3',
  187. 'MakerNoteSony4',
  188. 'MakerNoteSony5',
  189. 'MakerNoteSonyEricsson',
  190. 'MakerNoteSonySRF',
  191. 'MakerNoteUnknownText',
  192. 'MakerNoteUnknownBinary',
  193. 'MakerNoteUnknown',
  194. ],
  195. # "unsafe" tags we normally don't copy in JPEG images, defined
  196. # as a shortcut to use when rebuilding JPEG EXIF from scratch
  197. Unsafe => [
  198. 'IFD0:YCbCrPositioning',
  199. 'IFD0:YCbCrCoefficients',
  200. 'IFD0:TransferFunction',
  201. 'ExifIFD:ComponentsConfiguration',
  202. 'ExifIFD:CompressedBitsPerPixel',
  203. 'InteropIFD:InteropIndex',
  204. 'InteropIFD:InteropVersion',
  205. 'InteropIFD:RelatedImageWidth',
  206. 'InteropIFD:RelatedImageHeight',
  207. ],
  208. # standard tags used to define the color space of an image
  209. # (useful to preserve color space when deleting all meta information)
  210. ColorSpaceTags => [
  211. 'ExifIFD:ColorSpace',
  212. 'ExifIFD:Gamma',
  213. 'InteropIFD:InteropIndex',
  214. 'ICC_Profile',
  215. ],
  216. # common metadata tags found in IFD0 of TIFF images
  217. CommonIFD0 => [
  218. # standard EXIF
  219. 'IFD0:ImageDescription',
  220. 'IFD0:Make',
  221. 'IFD0:Model',
  222. 'IFD0:Software',
  223. 'IFD0:ModifyDate',
  224. 'IFD0:Artist',
  225. 'IFD0:Copyright',
  226. # other TIFF tags
  227. 'IFD0:Rating',
  228. 'IFD0:RatingPercent',
  229. 'IFD0:DNGLensInfo',
  230. 'IFD0:PanasonicTitle',
  231. 'IFD0:PanasonicTitle2',
  232. 'IFD0:XPTitle',
  233. 'IFD0:XPComment',
  234. 'IFD0:XPAuthor',
  235. 'IFD0:XPKeywords',
  236. 'IFD0:XPSubject',
  237. ],
  238. # large binary data tags which won't be loaded if excluded when extracting
  239. LargeTags => [
  240. 'CanonVRD',
  241. 'DLOData',
  242. 'EXIF',
  243. 'ICC_Profile',
  244. 'IDCPreviewImage',
  245. 'ImageData',
  246. 'IPTC',
  247. 'JpgFromRaw',
  248. 'OriginalRawImage',
  249. 'OtherImage',
  250. 'PreviewImage',
  251. 'ThumbnailImage',
  252. 'TIFFPreview',
  253. 'XML',
  254. 'XMP',
  255. 'ZoomedPreviewImage',
  256. ],
  257. );
  258. #------------------------------------------------------------------------------
  259. # load user-defined shortcuts if available
  260. # Inputs: reference to user-defined shortcut hash
  261. sub LoadShortcuts($)
  262. {
  263. my $shortcuts = shift;
  264. my $shortcut;
  265. foreach $shortcut (keys %$shortcuts) {
  266. my $val = $$shortcuts{$shortcut};
  267. # also allow simple aliases
  268. $val = [ $val ] unless ref $val eq 'ARRAY';
  269. # save the user-defined shortcut or alias
  270. $Image::ExifTool::Shortcuts::Main{$shortcut} = $val;
  271. }
  272. }
  273. # (for backward compatibility, renamed in ExifTool 7.75)
  274. if (%Image::ExifTool::Shortcuts::UserDefined) {
  275. LoadShortcuts(\%Image::ExifTool::Shortcuts::UserDefined);
  276. }
  277. if (%Image::ExifTool::UserDefined::Shortcuts) {
  278. LoadShortcuts(\%Image::ExifTool::UserDefined::Shortcuts);
  279. }
  280. 1; # end
  281. __END__
  282. =head1 NAME
  283. Image::ExifTool::Shortcuts - ExifTool shortcut tags
  284. =head1 SYNOPSIS
  285. This module is required by Image::ExifTool.
  286. =head1 DESCRIPTION
  287. This module contains definitions for tag name shortcuts used by
  288. Image::ExifTool. You can customize this file to add your own shortcuts.
  289. Individual users may also add their own shortcuts to the .ExifTool_config
  290. file in their home directory (or the directory specified by the
  291. EXIFTOOL_HOME environment variable). The shortcuts are defined in a hash
  292. called %Image::ExifTool::UserDefined::Shortcuts. The keys of the hash are
  293. the shortcut names, and the elements are either tag names or references to
  294. lists of tag names.
  295. An example shortcut definition in .ExifTool_config:
  296. %Image::ExifTool::UserDefined::Shortcuts = (
  297. MyShortcut => ['createdate','exif:exposuretime','aperture'],
  298. MyAlias => 'FocalLengthIn35mmFormat',
  299. );
  300. In this example, MyShortcut is a shortcut for the CreateDate,
  301. EXIF:ExposureTime and Aperture tags, and MyAlias is a shortcut for
  302. FocalLengthIn35mmFormat.
  303. The target tag names may contain an optional group name prefix. A group
  304. name applied to the shortcut will be ignored for any target tag with a group
  305. name prefix.
  306. =head1 AUTHOR
  307. Copyright 2003-2016, Phil Harvey (phil at owl.phy.queensu.ca)
  308. This library is free software; you can redistribute it and/or modify it
  309. under the same terms as Perl itself.
  310. =head1 SEE ALSO
  311. L<Image::ExifTool(3pm)|Image::ExifTool>
  312. =cut