-
Notifications
You must be signed in to change notification settings - Fork 335
/
Copy pathExif.pm
6809 lines (6691 loc) · 245 KB
/
Exif.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#------------------------------------------------------------------------------
# File: Exif.pm
#
# Description: Read EXIF/TIFF meta information
#
# Revisions: 11/25/2003 - P. Harvey Created
# 02/06/2004 - P. Harvey Moved processing functions from ExifTool
# 03/19/2004 - P. Harvey Check PreviewImage for validity
# 11/11/2004 - P. Harvey Split off maker notes into MakerNotes.pm
# 12/13/2004 - P. Harvey Added AUTOLOAD to load write routines
#
# References: 0) http://www.exif.org/Exif2-2.PDF
# 1) http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf
# 2) http://www.adobe.com/products/dng/pdfs/dng_spec_1_3_0_0.pdf
# 3) http://www.awaresystems.be/imaging/tiff/tifftags.html
# 4) http://www.remotesensing.org/libtiff/TIFFTechNote2.html
# 5) http://www.exif.org/dcf.PDF
# 6) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
# 7) http://www.fine-view.com/jp/lab/doc/ps6ffspecsv2.pdf
# 8) http://www.ozhiker.com/electronics/pjmt/jpeg_info/meta.html
# 9) http://hul.harvard.edu/jhove/tiff-tags.html
# 10) http://partners.adobe.com/public/developer/en/tiff/TIFFPM6.pdf
# 11) Robert Mucke private communication
# 12) http://www.broomscloset.com/closet/photo/exif/TAG2000-22_DIS12234-2.PDF
# 13) http://www.microsoft.com/whdc/xps/wmphoto.mspx
# 14) http://www.asmail.be/msg0054681802.html
# 15) http://crousseau.free.fr/imgfmt_raw.htm
# 16) http://www.cybercom.net/~dcoffin/dcraw/
# 17) http://www.digitalpreservation.gov/formats/content/tiff_tags.shtml
# 18) http://www.asmail.be/msg0055568584.html
# 19) http://libpsd.graphest.com/files/Photoshop%20File%20Formats.pdf
# 20) http://tiki-lounge.com/~raf/tiff/fields.html
# 21) http://community.roxen.com/developers/idocs/rfc/rfc3949.html
# 22) http://tools.ietf.org/html/draft-ietf-fax-tiff-fx-extension1-01
# 23) MetaMorph Stack (STK) Image File Format:
# --> ftp://ftp.meta.moleculardevices.com/support/stack/STK.doc
# 24) http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf (Exif 2.3)
# 25) Vesa Kivisto private communication (7D)
# 26) Jeremy Brown private communication
# 27) Gregg Lee private communication
# 28) http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/cinemadng/pdfs/CinemaDNG_Format_Specification_v1_1.pdf
# 29) http://www.libtiff.org
# 30) http://geotiff.maptools.org/spec/geotiffhome.html
# 31) https://android.googlesource.com/platform/external/dng_sdk/+/refs/heads/master/source/dng_tag_codes.h
# 32) Jeffry Friedl private communication
# IB) Iliah Borg private communication (LibRaw)
# JD) Jens Duttke private communication
#------------------------------------------------------------------------------
package Image::ExifTool::Exif;
use strict;
use vars qw($VERSION $AUTOLOAD @formatSize @formatName %formatNumber %intFormat
%lightSource %flash %compression %photometricInterpretation %orientation
%subfileType %saveForValidate);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::MakerNotes;
$VERSION = '4.38';
sub ProcessExif($$$);
sub WriteExif($$$);
sub CheckExif($$$);
sub RebuildMakerNotes($$$);
sub EncodeExifText($$);
sub ValidateIFD($;$);
sub ValidateImageData($$$;$);
sub ProcessTiffIFD($$$);
sub PrintParameter($$$);
sub GetOffList($$$$$);
sub PrintOpcode($$$);
sub PrintLensInfo($);
sub ConvertLensInfo($);
# size limit for loading binary data block into memory
sub BINARY_DATA_LIMIT { return 10 * 1024 * 1024; }
# byte sizes for the various EXIF format types below
@formatSize = (undef,1,1,2,4,8,1,1,2,4,8,4,8,4,2,8,8,8,8);
@formatName = (
undef, 'int8u', 'string', 'int16u',
'int32u', 'rational64u','int8s', 'undef',
'int16s', 'int32s', 'rational64s','float',
'double', 'ifd', 'unicode', 'complex',
'int64u', 'int64s', 'ifd64', # (new BigTIFF formats)
);
# hash to look up EXIF format numbers by name
# (format types are all lower case)
%formatNumber = (
'int8u' => 1, # BYTE
'string' => 2, # ASCII
'int16u' => 3, # SHORT
'int32u' => 4, # LONG
'rational64u' => 5, # RATIONAL
'int8s' => 6, # SBYTE
'undef' => 7, # UNDEFINED
'binary' => 7, # (same as undef)
'int16s' => 8, # SSHORT
'int32s' => 9, # SLONG
'rational64s' => 10, # SRATIONAL
'float' => 11, # FLOAT
'double' => 12, # DOUBLE
'ifd' => 13, # IFD (with int32u format)
'unicode' => 14, # UNICODE [see Note below]
'complex' => 15, # COMPLEX [see Note below]
'int64u' => 16, # LONG8 [BigTIFF]
'int64s' => 17, # SLONG8 [BigTIFF]
'ifd64' => 18, # IFD8 (with int64u format) [BigTIFF]
# Note: unicode and complex types are not yet properly supported by ExifTool.
# These are types which have been observed in the Adobe DNG SDK code, but
# aren't fully supported there either. We know the sizes, but that's about it.
# We don't know if the unicode is null terminated, or the format for complex
# (although I suspect it would be two 4-byte floats, real and imaginary).
);
# lookup for integer format strings
%intFormat = (
'int8u' => 1,
'int16u' => 3,
'int32u' => 4,
'int8s' => 6,
'int16s' => 8,
'int32s' => 9,
'ifd' => 13,
'int64u' => 16,
'int64s' => 17,
'ifd64' => 18,
);
# EXIF LightSource PrintConv values
%lightSource = (
0 => 'Unknown',
1 => 'Daylight',
2 => 'Fluorescent',
3 => 'Tungsten (Incandescent)',
4 => 'Flash',
9 => 'Fine Weather',
10 => 'Cloudy',
11 => 'Shade',
12 => 'Daylight Fluorescent', # (D 5700 - 7100K)
13 => 'Day White Fluorescent', # (N 4600 - 5500K)
14 => 'Cool White Fluorescent', # (W 3800 - 4500K)
15 => 'White Fluorescent', # (WW 3250 - 3800K)
16 => 'Warm White Fluorescent', # (L 2600 - 3250K)
17 => 'Standard Light A',
18 => 'Standard Light B',
19 => 'Standard Light C',
20 => 'D55',
21 => 'D65',
22 => 'D75',
23 => 'D50',
24 => 'ISO Studio Tungsten',
255 => 'Other',
);
# EXIF Flash values
%flash = (
OTHER => sub {
# translate "Off" and "On" when writing
my ($val, $inv) = @_;
return undef unless $inv and $val =~ /^(off|on)$/i;
return lc $val eq 'off' ? 0x00 : 0x01;
},
0x00 => 'No Flash',
0x01 => 'Fired',
0x05 => 'Fired, Return not detected',
0x07 => 'Fired, Return detected',
0x08 => 'On, Did not fire', # not charged up?
0x09 => 'On, Fired',
0x0d => 'On, Return not detected',
0x0f => 'On, Return detected',
0x10 => 'Off, Did not fire',
0x14 => 'Off, Did not fire, Return not detected',
0x18 => 'Auto, Did not fire',
0x19 => 'Auto, Fired',
0x1d => 'Auto, Fired, Return not detected',
0x1f => 'Auto, Fired, Return detected',
0x20 => 'No flash function',
0x30 => 'Off, No flash function',
0x41 => 'Fired, Red-eye reduction',
0x45 => 'Fired, Red-eye reduction, Return not detected',
0x47 => 'Fired, Red-eye reduction, Return detected',
0x49 => 'On, Red-eye reduction',
0x4d => 'On, Red-eye reduction, Return not detected',
0x4f => 'On, Red-eye reduction, Return detected',
0x50 => 'Off, Red-eye reduction',
0x58 => 'Auto, Did not fire, Red-eye reduction',
0x59 => 'Auto, Fired, Red-eye reduction',
0x5d => 'Auto, Fired, Red-eye reduction, Return not detected',
0x5f => 'Auto, Fired, Red-eye reduction, Return detected',
);
# TIFF Compression values
# (values with format "Xxxxx XXX Compressed" are used to identify RAW file types)
%compression = (
1 => 'Uncompressed',
2 => 'CCITT 1D',
3 => 'T4/Group 3 Fax',
4 => 'T6/Group 4 Fax',
5 => 'LZW',
6 => 'JPEG (old-style)', #3
7 => 'JPEG', #4
8 => 'Adobe Deflate', #3
9 => 'JBIG B&W', #3
10 => 'JBIG Color', #3
99 => 'JPEG', #16
262 => 'Kodak 262', #16
32766 => 'Next', #3
32767 => 'Sony ARW Compressed', #16
32769 => 'Packed RAW', #PH (used by Epson, Nikon, Samsung)
32770 => 'Samsung SRW Compressed', #PH
32771 => 'CCIRLEW', #3
32772 => 'Samsung SRW Compressed 2', #PH (NX3000,NXmini)
32773 => 'PackBits',
32809 => 'Thunderscan', #3
32867 => 'Kodak KDC Compressed', #PH
32895 => 'IT8CTPAD', #3
32896 => 'IT8LW', #3
32897 => 'IT8MP', #3
32898 => 'IT8BL', #3
32908 => 'PixarFilm', #3
32909 => 'PixarLog', #3
# 32910,32911 - Pixar reserved
32946 => 'Deflate', #3
32947 => 'DCS', #3
33003 => 'Aperio JPEG 2000 YCbCr', #https://openslide.org/formats/aperio/
33005 => 'Aperio JPEG 2000 RGB', #https://openslide.org/formats/aperio/
34661 => 'JBIG', #3
34676 => 'SGILog', #3
34677 => 'SGILog24', #3
34712 => 'JPEG 2000', #3
34713 => 'Nikon NEF Compressed', #PH
34715 => 'JBIG2 TIFF FX', #20
34718 => 'Microsoft Document Imaging (MDI) Binary Level Codec', #18
34719 => 'Microsoft Document Imaging (MDI) Progressive Transform Codec', #18
34720 => 'Microsoft Document Imaging (MDI) Vector', #18
34887 => 'ESRI Lerc', #LibTiff
# 34888,34889 - ESRI reserved
34892 => 'Lossy JPEG', # (DNG 1.4)
34925 => 'LZMA2', #LibTiff
34926 => 'Zstd', #LibTiff
34927 => 'WebP', #LibTiff
34933 => 'PNG', # (TIFF mail list)
34934 => 'JPEG XR', # (TIFF mail list)
65000 => 'Kodak DCR Compressed', #PH
65535 => 'Pentax PEF Compressed', #Jens
);
%photometricInterpretation = (
0 => 'WhiteIsZero',
1 => 'BlackIsZero',
2 => 'RGB',
3 => 'RGB Palette',
4 => 'Transparency Mask',
5 => 'CMYK',
6 => 'YCbCr',
8 => 'CIELab',
9 => 'ICCLab', #3
10 => 'ITULab', #3
32803 => 'Color Filter Array', #2
32844 => 'Pixar LogL', #3
32845 => 'Pixar LogLuv', #3
32892 => 'Sequential Color Filter', #JR (Sony ARQ)
34892 => 'Linear Raw', #2
51177 => 'Depth Map', # (DNG 1.5)
52527 => 'Semantic Mask', # (DNG 1.6)
);
%orientation = (
1 => 'Horizontal (normal)',
2 => 'Mirror horizontal',
3 => 'Rotate 180',
4 => 'Mirror vertical',
5 => 'Mirror horizontal and rotate 270 CW',
6 => 'Rotate 90 CW',
7 => 'Mirror horizontal and rotate 90 CW',
8 => 'Rotate 270 CW',
);
%subfileType = (
0 => 'Full-resolution image',
1 => 'Reduced-resolution image',
2 => 'Single page of multi-page image',
3 => 'Single page of multi-page reduced-resolution image',
4 => 'Transparency mask',
5 => 'Transparency mask of reduced-resolution image',
6 => 'Transparency mask of multi-page image',
7 => 'Transparency mask of reduced-resolution multi-page image',
8 => 'Depth map', # (DNG 1.5)
9 => 'Depth map of reduced-resolution image', # (DNG 1.5)
16 => 'Enhanced image data', # (DNG 1.5)
0x10001 => 'Alternate reduced-resolution image', # (DNG 1.2)
0x10004 => 'Semantic Mask', # (DNG 1.6)
0xffffffff => 'invalid', #(found in E5700 NEF's)
BITMASK => {
0 => 'Reduced resolution',
1 => 'Single page',
2 => 'Transparency mask',
3 => 'TIFF/IT final page', #20 (repurposed as DepthMap repurposes by DNG 1.5)
4 => 'TIFF-FX mixed raster content', #20 (repurposed as EnhancedImageData by DNG 1.5)
},
);
# PrintConv for parameter tags
%Image::ExifTool::Exif::printParameter = (
PrintConv => {
0 => 'Normal',
OTHER => \&Image::ExifTool::Exif::PrintParameter,
},
);
# convert DNG UTF-8 string values (may be string or int8u format)
my %utf8StringConv = (
Writable => 'string',
Format => 'string',
ValueConv => '$self->Decode($val, "UTF8")',
ValueConvInv => '$self->Encode($val,"UTF8")',
);
# ValueConv that makes long values binary type
my %longBin = (
ValueConv => 'length($val) > 64 ? \$val : $val',
ValueConvInv => '$val',
LongBinary => 1, # flag to avoid decoding values of a large array
);
# PrintConv for SampleFormat (0x153)
my %sampleFormat = (
1 => 'Unsigned', # unsigned integer
2 => 'Signed', # two's complement signed integer
3 => 'Float', # IEEE floating point
4 => 'Undefined',
5 => 'Complex int', # complex integer (ref 3)
6 => 'Complex float', # complex IEEE floating point (ref 3)
);
# save the values of these tags for additional validation checks
%saveForValidate = (
0x100 => 1, # ImageWidth
0x101 => 1, # ImageHeight
0x102 => 1, # BitsPerSample
0x103 => 1, # Compression
0x115 => 1, # SamplesPerPixel
);
# conversions for DNG OpcodeList tags
my %opcodeInfo = (
Writable => 'undef',
WriteGroup => 'SubIFD',
Protected => 1,
Binary => 1,
ConvertBinary => 1, # needed because the ValueConv value is binary
PrintConvColumns => 2,
PrintConv => {
OTHER => \&PrintOpcode,
1 => 'WarpRectilinear',
2 => 'WarpFisheye',
3 => 'FixVignetteRadial',
4 => 'FixBadPixelsConstant',
5 => 'FixBadPixelsList',
6 => 'TrimBounds',
7 => 'MapTable',
8 => 'MapPolynomial',
9 => 'GainMap',
10 => 'DeltaPerRow',
11 => 'DeltaPerColumn',
12 => 'ScalePerRow',
13 => 'ScalePerColumn',
14 => 'WarpRectilinear2', # (DNG 1.6)
},
PrintConvInv => undef, # (so the inverse conversion is not performed)
);
# main EXIF tag table
%Image::ExifTool::Exif::Main = (
GROUPS => { 0 => 'EXIF', 1 => 'IFD0', 2 => 'Image'},
WRITE_PROC => \&WriteExif,
CHECK_PROC => \&CheckExif,
WRITE_GROUP => 'ExifIFD', # default write group
SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
0x1 => {
Name => 'InteropIndex',
Description => 'Interoperability Index',
Protected => 1,
Writable => 'string',
WriteGroup => 'InteropIFD',
PrintConv => {
R98 => 'R98 - DCF basic file (sRGB)',
R03 => 'R03 - DCF option file (Adobe RGB)',
THM => 'THM - DCF thumbnail file',
},
},
0x2 => { #5
Name => 'InteropVersion',
Description => 'Interoperability Version',
Protected => 1,
Writable => 'undef',
Mandatory => 1,
WriteGroup => 'InteropIFD',
RawConv => '$val=~s/\0+$//; $val', # (some idiots add null terminators)
},
0x0b => { #PH
Name => 'ProcessingSoftware',
Writable => 'string',
WriteGroup => 'IFD0',
Notes => 'used by ACD Systems Digital Imaging',
},
0xfe => {
Name => 'SubfileType',
Notes => 'called NewSubfileType by the TIFF specification',
Protected => 1,
Writable => 'int32u',
WriteGroup => 'IFD0',
# set priority directory if this is the full resolution image
DataMember => 'SubfileType',
RawConv => '$self->SetPriorityDir() if $val eq "0"; $$self{SubfileType} = $val',
PrintConv => \%subfileType,
},
0xff => {
Name => 'OldSubfileType',
Notes => 'called SubfileType by the TIFF specification',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
# set priority directory if this is the full resolution image
RawConv => '$self->SetPriorityDir() if $val eq "1"; $val',
PrintConv => {
1 => 'Full-resolution image',
2 => 'Reduced-resolution image',
3 => 'Single page of multi-page image',
},
},
0x100 => {
Name => 'ImageWidth',
# even though Group 1 is set dynamically we need to register IFD1 once
# so it will show up in the group lists
Groups => { 1 => 'IFD1' },
Protected => 1,
Writable => 'int32u',
WriteGroup => 'IFD0',
# Note: priority 0 tags automatically have their priority increased for the
# priority directory (the directory with a SubfileType of "Full-resolution image")
Priority => 0,
},
0x101 => {
Name => 'ImageHeight',
Notes => 'called ImageLength by the EXIF spec.',
Protected => 1,
Writable => 'int32u',
WriteGroup => 'IFD0',
Priority => 0,
},
0x102 => {
Name => 'BitsPerSample',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
Count => -1, # can be 1 or 3: -1 means 'variable'
Priority => 0,
},
0x103 => {
Name => 'Compression',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
Mandatory => 1,
DataMember => 'Compression',
SeparateTable => 'Compression',
RawConv => q{
Image::ExifTool::Exif::IdentifyRawFile($self, $val);
return $$self{Compression} = $val;
},
PrintConv => \%compression,
Priority => 0,
},
0x106 => {
Name => 'PhotometricInterpretation',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => \%photometricInterpretation,
Priority => 0,
},
0x107 => {
Name => 'Thresholding',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => {
1 => 'No dithering or halftoning',
2 => 'Ordered dither or halftone',
3 => 'Randomized dither',
},
},
0x108 => {
Name => 'CellWidth',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
},
0x109 => {
Name => 'CellLength',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
},
0x10a => {
Name => 'FillOrder',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => {
1 => 'Normal',
2 => 'Reversed',
},
},
0x10d => {
Name => 'DocumentName',
Writable => 'string',
WriteGroup => 'IFD0',
},
0x10e => {
Name => 'ImageDescription',
Writable => 'string',
WriteGroup => 'IFD0',
Priority => 0,
},
0x10f => {
Name => 'Make',
Groups => { 2 => 'Camera' },
Writable => 'string',
WriteGroup => 'IFD0',
DataMember => 'Make',
# remove trailing blanks and save as an ExifTool member variable
RawConv => '$val =~ s/\s+$//; $$self{Make} = $val',
# NOTE: trailing "blanks" (spaces) are removed from all EXIF tags which
# may be "unknown" (filled with spaces) according to the EXIF spec.
# This allows conditional replacement with "exiftool -TAG-= -TAG=VALUE".
# - also removed are any other trailing whitespace characters
},
0x110 => {
Name => 'Model',
Description => 'Camera Model Name',
Groups => { 2 => 'Camera' },
Writable => 'string',
WriteGroup => 'IFD0',
DataMember => 'Model',
# remove trailing blanks and save as an ExifTool member variable
RawConv => '$val =~ s/\s+$//; $$self{Model} = $val',
},
0x111 => [
{
Condition => q[
$$self{TIFF_TYPE} eq 'MRW' and $$self{DIR_NAME} eq 'IFD0' and
$$self{Model} =~ /^DiMAGE A200/
],
Name => 'StripOffsets',
IsOffset => 1,
OffsetPair => 0x117, # point to associated byte counts
# A200 stores this information in the wrong byte order!!
ValueConv => '$val=join(" ",unpack("N*",pack("V*",split(" ",$val))));\$val',
ByteOrder => 'LittleEndian',
},
{
# (APP1 IFD2 is for Leica JPEG preview)
Condition => q[
not ($$self{TIFF_TYPE} eq 'CR2' and $$self{DIR_NAME} eq 'IFD0') and
not ($$self{TIFF_TYPE} =~ /^(DNG|TIFF)$/ and $$self{Compression} eq '7' and $$self{SubfileType} ne '0') and
not ($$self{TIFF_TYPE} eq 'APP1' and $$self{DIR_NAME} eq 'IFD2')
],
Name => 'StripOffsets',
IsOffset => 1,
OffsetPair => 0x117, # point to associated byte counts
ValueConv => 'length($val) > 32 ? \$val : $val',
},
{
# PreviewImageStart in IFD0 of CR2 images
Condition => '$$self{TIFF_TYPE} eq "CR2"',
Name => 'PreviewImageStart',
IsOffset => 1,
OffsetPair => 0x117,
Notes => q{
called StripOffsets in most locations, but it is PreviewImageStart in IFD0
of CR2 images and various IFD's of DNG images except for SubIFD2 where it is
JpgFromRawStart
},
DataTag => 'PreviewImage',
Writable => 'int32u',
WriteGroup => 'IFD0',
Protected => 2,
Permanent => 1,
},
{
# PreviewImageStart in various IFD's of DNG images except SubIFD2
Condition => '$$self{DIR_NAME} ne "SubIFD2"',
Name => 'PreviewImageStart',
IsOffset => 1,
OffsetPair => 0x117,
DataTag => 'PreviewImage',
Writable => 'int32u',
WriteGroup => 'All', # (writes to specific group of associated Composite tag)
Protected => 2,
Permanent => 1,
},
{
# JpgFromRawStart in various IFD's of DNG images except SubIFD2
Name => 'JpgFromRawStart',
IsOffset => 1,
OffsetPair => 0x117,
DataTag => 'JpgFromRaw',
Writable => 'int32u',
WriteGroup => 'SubIFD2',
Protected => 2,
Permanent => 1,
},
],
0x112 => {
Name => 'Orientation',
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => \%orientation,
Priority => 0, # so PRIORITY_DIR takes precedence
},
0x115 => {
Name => 'SamplesPerPixel',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
Priority => 0,
},
0x116 => {
Name => 'RowsPerStrip',
Protected => 1,
Writable => 'int32u',
WriteGroup => 'IFD0',
Priority => 0,
},
0x117 => [
{
Condition => q[
$$self{TIFF_TYPE} eq 'MRW' and $$self{DIR_NAME} eq 'IFD0' and
$$self{Model} =~ /^DiMAGE A200/
],
Name => 'StripByteCounts',
OffsetPair => 0x111, # point to associated offset
# A200 stores this information in the wrong byte order!!
ValueConv => '$val=join(" ",unpack("N*",pack("V*",split(" ",$val))));\$val',
ByteOrder => 'LittleEndian',
},
{
# (APP1 IFD2 is for Leica JPEG preview)
Condition => q[
not ($$self{TIFF_TYPE} eq 'CR2' and $$self{DIR_NAME} eq 'IFD0') and
not ($$self{TIFF_TYPE} =~ /^(DNG|TIFF)$/ and $$self{Compression} eq '7' and $$self{SubfileType} ne '0') and
not ($$self{TIFF_TYPE} eq 'APP1' and $$self{DIR_NAME} eq 'IFD2')
],
Name => 'StripByteCounts',
OffsetPair => 0x111, # point to associated offset
ValueConv => 'length($val) > 32 ? \$val : $val',
},
{
# PreviewImageLength in IFD0 of CR2 images
Condition => '$$self{TIFF_TYPE} eq "CR2"',
Name => 'PreviewImageLength',
OffsetPair => 0x111,
Notes => q{
called StripByteCounts in most locations, but it is PreviewImageLength in
IFD0 of CR2 images and various IFD's of DNG images except for SubIFD2 where
it is JpgFromRawLength
},
DataTag => 'PreviewImage',
Writable => 'int32u',
WriteGroup => 'IFD0',
Protected => 2,
Permanent => 1,
},
{
# PreviewImageLength in various IFD's of DNG images except SubIFD2
Condition => '$$self{DIR_NAME} ne "SubIFD2"',
Name => 'PreviewImageLength',
OffsetPair => 0x111,
DataTag => 'PreviewImage',
Writable => 'int32u',
WriteGroup => 'All', # (writes to specific group of associated Composite tag)
Protected => 2,
Permanent => 1,
},
{
# JpgFromRawLength in SubIFD2 of DNG images
Name => 'JpgFromRawLength',
OffsetPair => 0x111,
DataTag => 'JpgFromRaw',
Writable => 'int32u',
WriteGroup => 'SubIFD2',
Protected => 2,
Permanent => 1,
},
],
0x118 => {
Name => 'MinSampleValue',
Writable => 'int16u',
WriteGroup => 'IFD0',
},
0x119 => {
Name => 'MaxSampleValue',
Writable => 'int16u',
WriteGroup => 'IFD0',
},
0x11a => {
Name => 'XResolution',
Writable => 'rational64u',
WriteGroup => 'IFD0',
Mandatory => 1,
Priority => 0, # so PRIORITY_DIR takes precedence
},
0x11b => {
Name => 'YResolution',
Writable => 'rational64u',
WriteGroup => 'IFD0',
Mandatory => 1,
Priority => 0,
},
0x11c => {
Name => 'PlanarConfiguration',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => {
1 => 'Chunky',
2 => 'Planar',
},
Priority => 0,
},
0x11d => {
Name => 'PageName',
Writable => 'string',
WriteGroup => 'IFD0',
},
0x11e => {
Name => 'XPosition',
Writable => 'rational64u',
WriteGroup => 'IFD0',
},
0x11f => {
Name => 'YPosition',
Writable => 'rational64u',
WriteGroup => 'IFD0',
},
# FreeOffsets/FreeByteCounts are used by Ricoh for RMETA information
# in TIFF images (not yet supported)
0x120 => {
Name => 'FreeOffsets',
IsOffset => 1,
OffsetPair => 0x121,
ValueConv => 'length($val) > 32 ? \$val : $val',
},
0x121 => {
Name => 'FreeByteCounts',
OffsetPair => 0x120,
ValueConv => 'length($val) > 32 ? \$val : $val',
},
0x122 => {
Name => 'GrayResponseUnit',
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => { #3
1 => 0.1,
2 => 0.001,
3 => 0.0001,
4 => 0.00001,
5 => 0.000001,
},
},
0x123 => {
Name => 'GrayResponseCurve',
Binary => 1,
},
0x124 => {
Name => 'T4Options',
PrintConv => { BITMASK => {
0 => '2-Dimensional encoding',
1 => 'Uncompressed',
2 => 'Fill bits added',
} }, #3
},
0x125 => {
Name => 'T6Options',
PrintConv => { BITMASK => {
1 => 'Uncompressed',
} }, #3
},
0x128 => {
Name => 'ResolutionUnit',
Notes => 'the value 1 is not standard EXIF',
Writable => 'int16u',
WriteGroup => 'IFD0',
Mandatory => 1,
PrintConv => {
1 => 'None',
2 => 'inches',
3 => 'cm',
},
Priority => 0,
},
0x129 => {
Name => 'PageNumber',
Writable => 'int16u',
WriteGroup => 'IFD0',
Count => 2,
},
0x12c => 'ColorResponseUnit', #9
0x12d => {
Name => 'TransferFunction',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
Count => 768,
Binary => 1,
},
0x131 => {
Name => 'Software',
Writable => 'string',
WriteGroup => 'IFD0',
DataMember => 'Software',
RawConv => '$val =~ s/\s+$//; $$self{Software} = $val', # trim trailing blanks
},
0x132 => {
Name => 'ModifyDate',
Groups => { 2 => 'Time' },
Notes => 'called DateTime by the EXIF spec.',
Writable => 'string',
Shift => 'Time',
WriteGroup => 'IFD0',
Validate => 'ValidateExifDate($val)',
PrintConv => '$self->ConvertDateTime($val)',
PrintConvInv => '$self->InverseDateTime($val,0)',
},
0x13b => {
Name => 'Artist',
Groups => { 2 => 'Author' },
Notes => 'becomes a list-type tag when the MWG module is loaded',
Writable => 'string',
WriteGroup => 'IFD0',
RawConv => '$val =~ s/\s+$//; $val', # trim trailing blanks
},
0x13c => {
Name => 'HostComputer',
Writable => 'string',
WriteGroup => 'IFD0',
},
0x13d => {
Name => 'Predictor',
Protected => 1,
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => {
1 => 'None',
2 => 'Horizontal differencing',
3 => 'Floating point', # (DNG 1.5)
34892 => 'Horizontal difference X2', # (DNG 1.5)
34893 => 'Horizontal difference X4', # (DNG 1.5)
34894 => 'Floating point X2', # (DNG 1.5)
34895 => 'Floating point X4', # (DNG 1.5)
},
},
0x13e => {
Name => 'WhitePoint',
Groups => { 2 => 'Camera' },
Writable => 'rational64u',
WriteGroup => 'IFD0',
Count => 2,
},
0x13f => {
Name => 'PrimaryChromaticities',
Writable => 'rational64u',
WriteGroup => 'IFD0',
Count => 6,
Priority => 0,
},
0x140 => {
Name => 'ColorMap',
Format => 'binary',
Binary => 1,
},
0x141 => {
Name => 'HalftoneHints',
Writable => 'int16u',
WriteGroup => 'IFD0',
Count => 2,
},
0x142 => {
Name => 'TileWidth',
Protected => 1,
Writable => 'int32u',
WriteGroup => 'IFD0',
},
0x143 => {
Name => 'TileLength',
Protected => 1,
Writable => 'int32u',
WriteGroup => 'IFD0',
},
0x144 => {
Name => 'TileOffsets',
IsOffset => 1,
OffsetPair => 0x145,
ValueConv => 'length($val) > 32 ? \$val : $val',
},
0x145 => {
Name => 'TileByteCounts',
OffsetPair => 0x144,
ValueConv => 'length($val) > 32 ? \$val : $val',
},
0x146 => 'BadFaxLines', #3
0x147 => { #3
Name => 'CleanFaxData',
PrintConv => {
0 => 'Clean',
1 => 'Regenerated',
2 => 'Unclean',
},
},
0x148 => 'ConsecutiveBadFaxLines', #3
0x14a => [
{
Name => 'SubIFD',
# use this opportunity to identify an ARW image, and if so we
# must decide if this is a SubIFD or the A100 raw data
# (use SubfileType, Compression and FILE_TYPE to identify ARW/SR2,
# then call SetARW to finish the job)
Condition => q{
$$self{DIR_NAME} ne 'IFD0' or $$self{FILE_TYPE} ne 'TIFF' or
$$self{Make} !~ /^SONY/ or
not $$self{SubfileType} or $$self{SubfileType} != 1 or
not $$self{Compression} or $$self{Compression} != 6 or
not require Image::ExifTool::Sony or
Image::ExifTool::Sony::SetARW($self, $valPt)
},
Groups => { 1 => 'SubIFD' },
Flags => 'SubIFD',
SubDirectory => {
Start => '$val',
MaxSubdirs => 10, # (have seen 5 in a DNG 1.4 image)
},
},
{ #16
Name => 'A100DataOffset',
Notes => 'the data offset in original Sony DSLR-A100 ARW images',
DataMember => 'A100DataOffset',
RawConv => '$$self{A100DataOffset} = $val',
WriteGroup => 'IFD0', # (only for Validate)
IsOffset => 1,
Protected => 2,
},
],
0x14c => {
Name => 'InkSet',
Writable => 'int16u',
WriteGroup => 'IFD0',
PrintConv => { #3
1 => 'CMYK',
2 => 'Not CMYK',
},
},
0x14d => 'InkNames', #3
0x14e => 'NumberofInks', #3
0x150 => 'DotRange',
0x151 => {
Name => 'TargetPrinter',
Writable => 'string',
WriteGroup => 'IFD0',
},
0x152 => {
Name => 'ExtraSamples',
PrintConv => { #20
0 => 'Unspecified',
1 => 'Associated Alpha',
2 => 'Unassociated Alpha',
},
},
0x153 => {
Name => 'SampleFormat',
Notes => 'SamplesPerPixel values',
WriteGroup => 'SubIFD', # (only for Validate)
PrintConvColumns => 2,
PrintConv => [ \%sampleFormat, \%sampleFormat, \%sampleFormat, \%sampleFormat ],
},
0x154 => 'SMinSampleValue',
0x155 => 'SMaxSampleValue',
0x156 => 'TransferRange',
0x157 => 'ClipPath', #3
0x158 => 'XClipPathUnits', #3
0x159 => 'YClipPathUnits', #3
0x15a => { #3
Name => 'Indexed',
PrintConv => { 0 => 'Not indexed', 1 => 'Indexed' },
},
0x15b => {