source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Shortcuts.pm@ 34921

Last change on this file since 34921 was 34921, checked in by anupama, 3 years ago

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File size: 9.8 KB
Line 
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
17package Image::ExifTool::Shortcuts;
18
19use strict;
20use vars qw($VERSION);
21
22$VERSION = '1.65';
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%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 'MakerNoteFLIR',
122 'MakerNoteFujiFilm',
123 'MakerNoteGE',
124 'MakerNoteGE2',
125 'MakerNoteHasselblad',
126 'MakerNoteHP',
127 'MakerNoteHP2',
128 'MakerNoteHP4',
129 'MakerNoteHP6',
130 'MakerNoteISL',
131 'MakerNoteJVC',
132 'MakerNoteJVCText',
133 'MakerNoteKodak1a',
134 'MakerNoteKodak1b',
135 'MakerNoteKodak2',
136 'MakerNoteKodak3',
137 'MakerNoteKodak4',
138 'MakerNoteKodak5',
139 'MakerNoteKodak6a',
140 'MakerNoteKodak6b',
141 'MakerNoteKodak7',
142 'MakerNoteKodak8a',
143 'MakerNoteKodak8b',
144 'MakerNoteKodak8c',
145 'MakerNoteKodak9',
146 'MakerNoteKodak10',
147 'MakerNoteKodak11',
148 'MakerNoteKodak12',
149 'MakerNoteKodakUnknown',
150 'MakerNoteKyocera',
151 'MakerNoteMinolta',
152 'MakerNoteMinolta2',
153 'MakerNoteMinolta3',
154 'MakerNoteMotorola',
155 'MakerNoteNikon',
156 'MakerNoteNikon2',
157 'MakerNoteNikon3',
158 'MakerNoteNintendo',
159 'MakerNoteOlympus',
160 'MakerNoteOlympus2',
161 'MakerNoteLeica',
162 'MakerNoteLeica2',
163 'MakerNoteLeica3',
164 'MakerNoteLeica4',
165 'MakerNoteLeica5',
166 'MakerNoteLeica6',
167 'MakerNoteLeica7',
168 'MakerNoteLeica8',
169 'MakerNoteLeica9',
170 'MakerNoteLeica10',
171 'MakerNotePanasonic',
172 'MakerNotePanasonic2',
173 'MakerNotePanasonic3',
174 'MakerNotePentax',
175 'MakerNotePentax2',
176 'MakerNotePentax3',
177 'MakerNotePentax4',
178 'MakerNotePentax5',
179 'MakerNotePentax6',
180 'MakerNotePhaseOne',
181 'MakerNoteReconyx',
182 'MakerNoteReconyx2',
183 'MakerNoteReconyx3',
184 'MakerNoteRicoh',
185 'MakerNoteRicoh2',
186 'MakerNoteRicohPentax',
187 'MakerNoteRicohText',
188 'MakerNoteSamsung1a',
189 'MakerNoteSamsung1b',
190 'MakerNoteSamsung2',
191 'MakerNoteSanyo',
192 'MakerNoteSanyoC4',
193 'MakerNoteSanyoPatch',
194 'MakerNoteSigma',
195 'MakerNoteSony',
196 'MakerNoteSony2',
197 'MakerNoteSony3',
198 'MakerNoteSony4',
199 'MakerNoteSony5',
200 'MakerNoteSonyEricsson',
201 'MakerNoteSonySRF',
202 'MakerNoteUnknownText',
203 'MakerNoteUnknownBinary',
204 'MakerNoteUnknown',
205 ],
206 # "unsafe" tags we normally don't copy in JPEG images, defined
207 # as a shortcut to use when rebuilding JPEG EXIF from scratch
208 Unsafe => [
209 'IFD0:YCbCrPositioning',
210 'IFD0:YCbCrCoefficients',
211 'IFD0:TransferFunction',
212 'ExifIFD:ComponentsConfiguration',
213 'ExifIFD:CompressedBitsPerPixel',
214 'InteropIFD:InteropIndex',
215 'InteropIFD:InteropVersion',
216 'InteropIFD:RelatedImageWidth',
217 'InteropIFD:RelatedImageHeight',
218 ],
219 # standard tags used to define the color space of an image
220 # (useful to preserve color space when deleting all meta information)
221 ColorSpaceTags => [
222 'ExifIFD:ColorSpace',
223 'ExifIFD:Gamma',
224 'InteropIFD:InteropIndex',
225 'ICC_Profile',
226 ],
227 # common metadata tags found in IFD0 of TIFF images
228 CommonIFD0 => [
229 # standard EXIF
230 'IFD0:ImageDescription',
231 'IFD0:Make',
232 'IFD0:Model',
233 'IFD0:Software',
234 'IFD0:ModifyDate',
235 'IFD0:Artist',
236 'IFD0:Copyright',
237 # other TIFF tags
238 'IFD0:Rating',
239 'IFD0:RatingPercent',
240 'IFD0:DNGLensInfo',
241 'IFD0:PanasonicTitle',
242 'IFD0:PanasonicTitle2',
243 'IFD0:XPTitle',
244 'IFD0:XPComment',
245 'IFD0:XPAuthor',
246 'IFD0:XPKeywords',
247 'IFD0:XPSubject',
248 ],
249 # large binary data tags which won't be loaded if excluded when extracting
250 LargeTags => [
251 'CanonVRD',
252 'DLOData',
253 'EXIF',
254 'ICC_Profile',
255 'IDCPreviewImage',
256 'ImageData',
257 'IPTC',
258 'JpgFromRaw',
259 'OriginalRawImage',
260 'OtherImage',
261 'PreviewImage',
262 'ThumbnailImage',
263 'TIFFPreview',
264 'XML',
265 'XMP',
266 'ZoomedPreviewImage',
267 ],
268 'ls-l' => [
269 'FilePermissions',
270 'FileHardLinks',
271 'FileUserID',
272 'FileGroupID',
273 'FileSize#',
274 'FileModifyDate',
275 'FileName',
276 ],
277);
278
279#------------------------------------------------------------------------------
280# load user-defined shortcuts if available
281# Inputs: reference to user-defined shortcut hash
282sub LoadShortcuts($)
283{
284 my $shortcuts = shift;
285 my $shortcut;
286 foreach $shortcut (keys %$shortcuts) {
287 my $val = $$shortcuts{$shortcut};
288 # also allow simple aliases
289 $val = [ $val ] unless ref $val eq 'ARRAY';
290 # save the user-defined shortcut or alias
291 $Image::ExifTool::Shortcuts::Main{$shortcut} = $val;
292 }
293}
294# (for backward compatibility, renamed in ExifTool 7.75)
295if (%Image::ExifTool::Shortcuts::UserDefined) {
296 LoadShortcuts(\%Image::ExifTool::Shortcuts::UserDefined);
297}
298if (%Image::ExifTool::UserDefined::Shortcuts) {
299 LoadShortcuts(\%Image::ExifTool::UserDefined::Shortcuts);
300}
301
302
3031; # end
304
305__END__
306
307=head1 NAME
308
309Image::ExifTool::Shortcuts - ExifTool shortcut tags
310
311=head1 SYNOPSIS
312
313This module is required by Image::ExifTool.
314
315=head1 DESCRIPTION
316
317This module contains definitions for tag name shortcuts used by
318Image::ExifTool. You can customize this file to add your own shortcuts.
319
320Individual users may also add their own shortcuts to the .ExifTool_config
321file in their home directory (or the directory specified by the
322EXIFTOOL_HOME environment variable). The shortcuts are defined in a hash
323called %Image::ExifTool::UserDefined::Shortcuts. The keys of the hash are
324the shortcut names, and the elements are either tag names or references to
325lists of tag names.
326
327An example shortcut definition in .ExifTool_config:
328
329 %Image::ExifTool::UserDefined::Shortcuts = (
330 MyShortcut => ['createdate','exif:exposuretime','aperture'],
331 MyAlias => 'FocalLengthIn35mmFormat',
332 );
333
334In this example, MyShortcut is a shortcut for the CreateDate,
335EXIF:ExposureTime and Aperture tags, and MyAlias is a shortcut for
336FocalLengthIn35mmFormat.
337
338The target tag names may contain an optional group name prefix. A group
339name applied to the shortcut will be ignored for any target tag with a group
340name prefix.
341
342=head1 AUTHOR
343
344Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
345
346This library is free software; you can redistribute it and/or modify it
347under the same terms as Perl itself.
348
349=head1 SEE ALSO
350
351L<Image::ExifTool(3pm)|Image::ExifTool>
352
353=cut
Note: See TracBrowser for help on using the repository browser.