source: gsdl/trunk/perllib/cpan/Image/ExifTool/Kodak.pm@ 16842

Last change on this file since 16842 was 16842, checked in by davidb, 16 years ago

ExifTool added to cpan area to support metadata extraction from files such as JPEG. Primarily targetted as Image files (hence the Image folder name decided upon by the ExifTool author) it also can handle video such as flash and audio such as Wav

File size: 32.2 KB
Line 
1#------------------------------------------------------------------------------
2# File: Kodak.pm
3#
4# Description: Kodak EXIF maker notes and APP3 "Meta" tags
5#
6# Revisions: 03/28/2005 - P. Harvey Created
7#
8# References: 1) http://search.cpan.org/dist/Image-MetaData-JPEG/
9# 2) http://www.ozhiker.com/electronics/pjmt/jpeg_info/meta.html
10#
11# Notes: There really isn't much public information about Kodak formats.
12# The only source I could find was Image::MetaData::JPEG, which
13# didn't provide information about decoding the tag values. So
14# this module represents a lot of work downloading sample images
15# (about 100MB worth!), and testing with my daughter's CX4200.
16#------------------------------------------------------------------------------
17
18package Image::ExifTool::Kodak;
19
20use strict;
21use vars qw($VERSION);
22use Image::ExifTool::Exif;
23
24$VERSION = '1.10';
25
26sub ProcessKodakIFD($$$);
27sub WriteKodakIFD($$$);
28
29# Kodak type 1 maker notes (ref 1)
30%Image::ExifTool::Kodak::Main = (
31 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
32 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
33 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
34 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
35 NOTES => q{
36 The table below contains the most common set of Kodak tags. The following
37 Kodak camera models have been tested and found to use these tags: C360,
38 C663, C875, CX6330, CX6445, CX7330, CX7430, CX7525, CX7530, DC4800, DC4900,
39 DX3500, DX3600, DX3900, DX4330, DX4530, DX4900, DX6340, DX6440, DX6490,
40 DX7440, DX7590, DX7630, EasyShare-One, LS420, LS443, LS633, LS743, LS753,
41 V530, V550, V570, V603, V610, V705, Z650, Z700, Z710, Z730, Z740, Z760 and
42 Z7590.
43 },
44 WRITABLE => 1,
45 FIRST_ENTRY => 8,
46 0x00 => {
47 Name => 'KodakModel',
48 Format => 'string[8]',
49 },
50 0x09 => {
51 Name => 'Quality',
52 PrintConv => { #PH
53 1 => 'Fine',
54 2 => 'Normal',
55 },
56 },
57 0x0a => {
58 Name => 'BurstMode',
59 PrintConv => { 0 => 'Off', 1 => 'On' },
60 },
61 0x0c => {
62 Name => 'KodakImageWidth',
63 Format => 'int16u',
64 },
65 0x0e => {
66 Name => 'KodakImageHeight',
67 Format => 'int16u',
68 },
69 0x10 => {
70 Name => 'YearCreated',
71 Groups => { 2 => 'Time' },
72 Format => 'int16u',
73 },
74 0x12 => {
75 Name => 'MonthDayCreated',
76 Groups => { 2 => 'Time' },
77 Format => 'int8u[2]',
78 ValueConv => 'sprintf("%.2d:%.2d",split(" ", $val))',
79 ValueConvInv => '$val=~tr/:./ /;$val',
80 },
81 0x14 => {
82 Name => 'TimeCreated',
83 Groups => { 2 => 'Time' },
84 Format => 'int8u[4]',
85 Shift => 'Time',
86 ValueConv => 'sprintf("%.2d:%.2d:%.2d.%.2d",split(" ", $val))',
87 ValueConvInv => '$val=~tr/:./ /;$val',
88 },
89 0x18 => {
90 Name => 'BurstMode2',
91 Format => 'int16u',
92 Unknown => 1, # not sure about this tag (or other 'Unknown' tags)
93 },
94 0x1b => {
95 Name => 'ShutterMode',
96 PrintConv => { #PH
97 0 => 'Auto',
98 8 => 'Aperture Priority',
99 32 => 'Manual?',
100 },
101 },
102 0x1c => {
103 Name => 'MeteringMode',
104 PrintConv => { #PH
105 0 => 'Multi-pattern',
106 1 => 'Center-Weighted',
107 2 => 'Spot',
108 },
109 },
110 0x1d => 'SequenceNumber',
111 0x1e => {
112 Name => 'FNumber',
113 Format => 'int16u',
114 ValueConv => '$val / 100',
115 ValueConvInv => 'int($val * 100 + 0.5)',
116 },
117 0x20 => {
118 Name => 'ExposureTime',
119 Format => 'int32u',
120 ValueConv => '$val / 1e5',
121 ValueConvInv => '$val * 1e5',
122 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
123 PrintConvInv => 'eval $val',
124 },
125 0x24 => {
126 Name => 'ExposureCompensation',
127 Format => 'int16s',
128 ValueConv => '$val / 1000',
129 ValueConvInv => '$val * 1000',
130 PrintConv => '$val > 0 ? "+$val" : $val',
131 PrintConvInv => 'eval $val',
132 },
133 0x26 => {
134 Name => 'VariousModes',
135 Format => 'int16u',
136 Unknown => 1,
137 },
138 0x28 => {
139 Name => 'Distance1',
140 Format => 'int32u',
141 Unknown => 1,
142 },
143 0x2c => {
144 Name => 'Distance2',
145 Format => 'int32u',
146 Unknown => 1,
147 },
148 0x30 => {
149 Name => 'Distance3',
150 Format => 'int32u',
151 Unknown => 1,
152 },
153 0x34 => {
154 Name => 'Distance4',
155 Format => 'int32u',
156 Unknown => 1,
157 },
158 0x38 => {
159 Name => 'FocusMode',
160 PrintConv => {
161 0 => 'Normal',
162 2 => 'Macro',
163 },
164 },
165 0x3a => {
166 Name => 'VariousModes2',
167 Format => 'int16u',
168 Unknown => 1,
169 },
170 0x3c => {
171 Name => 'PanoramaMode',
172 Format => 'int16u',
173 Unknown => 1,
174 },
175 0x3e => {
176 Name => 'SubjectDistance',
177 Format => 'int16u',
178 Unknown => 1,
179 },
180 0x40 => {
181 Name => 'WhiteBalance',
182 Priority => 0,
183 PrintConv => { #PH
184 0 => 'Auto',
185 1 => 'Flash?',
186 2 => 'Tungsten',
187 3 => 'Daylight',
188 },
189 },
190 0x5c => {
191 Name => 'FlashMode',
192 Flags => 'PrintHex',
193 # various models express this number differently
194 PrintConv => { #PH
195 0x00 => 'Auto',
196 0x01 => 'Fill Flash',
197 0x02 => 'Off',
198 0x03 => 'Red-Eye',
199 0x10 => 'Fill Flash',
200 0x20 => 'Off',
201 0x40 => 'Red-Eye?',
202 },
203 },
204 0x5d => {
205 Name => 'FlashFired',
206 PrintConv => { 0 => 'No', 1 => 'Yes' },
207 },
208 0x5e => {
209 Name => 'ISOSetting',
210 Format => 'int16u',
211 PrintConv => '$val ? $val : "Auto"',
212 PrintConvInv => '$val=~/^\d+$/ ? $val : 0',
213 },
214 0x60 => {
215 Name => 'ISO',
216 Format => 'int16u',
217 },
218 0x62 => {
219 Name => 'TotalZoom',
220 Format => 'int16u',
221 ValueConv => '$val / 100',
222 ValueConvInv => '$val * 100',
223 },
224 0x64 => {
225 Name => 'DateTimeStamp',
226 Format => 'int16u',
227 PrintConv => '$val ? "Mode $val" : "Off"',
228 PrintConvInv => '$val=~tr/0-9//dc; $val ? $val : 0',
229 },
230 0x66 => {
231 Name => 'ColorMode',
232 Format => 'int16u',
233 Flags => 'PrintHex',
234 # various models express this number differently
235 PrintConv => { #PH
236 0x01 => 'B&W',
237 0x02 => 'Sepia',
238 0x03 => 'B&W Yellow Filter',
239 0x04 => 'B&W Red Filter',
240 0x20 => 'Saturated Color',
241 0x40 => 'Neutral Color',
242 0x100 => 'Saturated Color',
243 0x200 => 'Neutral Color',
244 0x2000 => 'B&W',
245 0x4000 => 'Sepia',
246 },
247 },
248 0x68 => {
249 Name => 'DigitalZoom',
250 Format => 'int16u',
251 ValueConv => '$val / 100',
252 ValueConvInv => '$val * 100',
253 },
254 0x6b => {
255 Name => 'Sharpness',
256 Format => 'int8s',
257 PrintConv => 'Image::ExifTool::Exif::PrintParameter($val)',
258 PrintConvInv => '$val=~/normal/i ? 0 : $val',
259 },
260);
261
262# Kodak type 2 maker notes (ref PH)
263%Image::ExifTool::Kodak::Type2 = (
264 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
265 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
266 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
267 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
268 NOTES => q{
269 These tags are used by the Kodak DC220, DC260, DC265 and DC290,
270 Hewlett-Packard PhotoSmart 618, C500 and C912, Pentax EI-200 and EI-2000,
271 and Minolta EX1500Z.
272 },
273 WRITABLE => 1,
274 FIRST_ENTRY => 0,
275 0x08 => {
276 Name => 'KodakMaker',
277 Format => 'string[32]',
278 },
279 0x28 => {
280 Name => 'KodakModel',
281 Format => 'string[32]',
282 },
283 0x6c => {
284 Name => 'KodakImageWidth',
285 Format => 'int32u',
286 },
287 0x70 => {
288 Name => 'KodakImageHeight',
289 Format => 'int32u',
290 },
291);
292
293# Kodak type 3 maker notes (ref PH)
294%Image::ExifTool::Kodak::Type3 = (
295 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
296 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
297 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
298 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
299 NOTES => 'These tags are used by the DC240, DC280, DC3400 and DC5000.',
300 WRITABLE => 1,
301 FIRST_ENTRY => 0,
302 0x0c => {
303 Name => 'YearCreated',
304 Groups => { 2 => 'Time' },
305 Format => 'int16u',
306 },
307 0x0e => {
308 Name => 'MonthDayCreated',
309 Groups => { 2 => 'Time' },
310 Format => 'int8u[2]',
311 ValueConv => 'sprintf("%.2d:%.2d",split(" ", $val))',
312 ValueConvInv => '$val=~tr/:./ /;$val',
313 },
314 0x10 => {
315 Name => 'TimeCreated',
316 Groups => { 2 => 'Time' },
317 Format => 'int8u[4]',
318 Shift => 'Time',
319 ValueConv => 'sprintf("%2d:%.2d:%.2d.%.2d",split(" ", $val))',
320 ValueConvInv => '$val=~tr/:./ /;$val',
321 },
322 0x1e => {
323 Name => 'OpticalZoom',
324 Format => 'int16u',
325 ValueConv => '$val / 100',
326 ValueConvInv => '$val * 100',
327 },
328 0x37 => {
329 Name => 'Sharpness',
330 Format => 'int8s',
331 PrintConv => 'Image::ExifTool::Exif::PrintParameter($val)',
332 PrintConvInv => '$val=~/normal/i ? 0 : $val',
333 },
334 0x38 => {
335 Name => 'ExposureTime',
336 Format => 'int32u',
337 ValueConv => '$val / 1e5',
338 ValueConvInv => '$val * 1e5',
339 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
340 PrintConvInv => 'eval $val',
341 },
342 0x3c => {
343 Name => 'FNumber',
344 Format => 'int16u',
345 ValueConv => '$val / 100',
346 ValueConvInv => 'int($val * 100 + 0.5)',
347 },
348 0x4e => {
349 Name => 'ISO',
350 Format => 'int16u',
351 },
352);
353
354# Kodak type 4 maker notes (ref PH)
355%Image::ExifTool::Kodak::Type4 = (
356 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
357 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
358 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
359 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
360 NOTES => 'These tags are used by the DC200 and DC215.',
361 WRITABLE => 1,
362 FIRST_ENTRY => 0,
363 0x20 => {
364 Name => 'OriginalFileName',
365 Format => 'string[12]',
366 },
367);
368
369# Kodak type 5 maker notes (ref PH)
370%Image::ExifTool::Kodak::Type5 = (
371 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
372 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
373 NOTES => q{
374 These tags are used by the CX4200, CX4210, CX4230, CX4300, CX4310, CX6200
375 and CX6230.
376 },
377 WRITABLE => 1,
378 FIRST_ENTRY => 0,
379 0x14 => {
380 Name => 'ExposureTime',
381 Format => 'int32u',
382 ValueConv => '$val / 1e5',
383 ValueConvInv => '$val * 1e5',
384 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
385 PrintConvInv => 'eval $val',
386 },
387 0x1a => {
388 Name => 'WhiteBalance',
389 PrintConv => {
390 1 => 'Daylight',
391 2 => 'Flash',
392 3 => 'Tungsten',
393 },
394 },
395 0x1c => {
396 Name => 'FNumber',
397 Format => 'int16u',
398 ValueConv => '$val / 100',
399 ValueConvInv => 'int($val * 100 + 0.5)',
400 },
401 0x1e => {
402 Name => 'ISO',
403 Format => 'int16u',
404 },
405 0x20 => {
406 Name => 'OpticalZoom',
407 Format => 'int16u',
408 ValueConv => '$val / 100',
409 ValueConvInv => '$val * 100',
410 },
411 0x22 => {
412 Name => 'DigitalZoom',
413 Format => 'int16u',
414 ValueConv => '$val / 100',
415 ValueConvInv => '$val * 100',
416 },
417 0x27 => {
418 Name => 'FlashMode',
419 PrintConv => {
420 0 => 'Auto',
421 1 => 'On',
422 2 => 'Off',
423 3 => 'Red-Eye',
424 },
425 },
426 0x2a => {
427 Name => 'ImageRotated',
428 PrintConv => { 0 => 'No', 1 => 'Yes' },
429 },
430 0x2b => {
431 Name => 'Macro',
432 PrintConv => { 0 => 'On', 1 => 'Off' },
433 },
434);
435
436# Kodak type 6 maker notes (ref PH)
437%Image::ExifTool::Kodak::Type6 = (
438 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
439 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
440 NOTES => 'These tags are used by the DX3215 and DX3700.',
441 WRITABLE => 1,
442 FIRST_ENTRY => 0,
443 0x10 => {
444 Name => 'ExposureTime',
445 Format => 'int32u',
446 ValueConv => '$val / 1e5',
447 ValueConvInv => '$val * 1e5',
448 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
449 PrintConvInv => 'eval $val',
450 },
451 0x14 => {
452 Name => 'ISOSetting',
453 Format => 'int32u',
454 Unknown => 1,
455 },
456 0x18 => {
457 Name => 'FNumber',
458 Format => 'int16u',
459 ValueConv => '$val / 100',
460 ValueConvInv => 'int($val * 100 + 0.5)',
461 },
462 0x1a => {
463 Name => 'ISO',
464 Format => 'int16u',
465 },
466 0x1c => {
467 Name => 'OpticalZoom',
468 Format => 'int16u',
469 ValueConv => '$val / 100',
470 ValueConvInv => '$val * 100',
471 },
472 0x1e => {
473 Name => 'DigitalZoom',
474 Format => 'int16u',
475 ValueConv => '$val / 100',
476 ValueConvInv => '$val * 100',
477 },
478 0x22 => {
479 Name => 'Flash',
480 Format => 'int16u',
481 PrintConv => {
482 0 => 'No Flash',
483 1 => 'Fired',
484 },
485 },
486);
487
488# Kodak type 7 maker notes (ref PH)
489%Image::ExifTool::Kodak::Type7 = (
490 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
491 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
492 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
493 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
494 WRITABLE => 1,
495 FIRST_ENTRY => 0,
496 NOTES => q{
497 The maker notes of models such as the C340, C433, CC533, LS755, V803 and
498 V1003 seem to start with the camera serial number. The C310, C315, C330,
499 C643, C743, CD33, CD43, CX7220 and CX7300 maker notes are also decoded using
500 this table, although the strings for these cameras don't conform to the
501 usual Kodak serial number format, and instead have the model name followed
502 by 8 digits.
503 },
504 0 => { # (not confirmed)
505 Name => 'SerialNumber',
506 Format => 'string[16]',
507 ValueConv => '$val=~s/\s+$//; $val', # remove trailing whitespace
508 ValueConvInv => '$val',
509 },
510);
511
512# Kodak IFD-format maker notes (ref PH)
513%Image::ExifTool::Kodak::IFD = (
514 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
515 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
516 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
517 NOTES => q{
518 Newer Kodak models such as the P712, P850, P880, Z612 and Z712 use standard
519 TIFF IFD format for the maker notes. There is a large amount of information
520 stored in these maker notes (with apparently much duplication), but
521 relatively few tags have so far been decoded.
522 },
523 0xfc00 => {
524 Name => 'SubIFD0',
525 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
526 Flags => 'SubIFD',
527 SubDirectory => {
528 TagTable => 'Image::ExifTool::Kodak::SubIFD0',
529 Start => '$val',
530 },
531 },
532 # SubIFD1 and higher data is preceded by a TIFF byte order mark to indicate
533 # the byte ordering used
534 0xfc01 => {
535 Name => 'SubIFD1',
536 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
537 Flags => 'SubIFD',
538 SubDirectory => {
539 TagTable => 'Image::ExifTool::Kodak::SubIFD1',
540 Start => '$val',
541 Base => '$start',
542 },
543 },
544 0xfc02 => {
545 Name => 'SubIFD2',
546 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
547 Flags => 'SubIFD',
548 SubDirectory => {
549 TagTable => 'Image::ExifTool::Kodak::SubIFD2',
550 Start => '$val',
551 Base => '$start',
552 },
553 },
554 0xfc03 => {
555 Name => 'SubIFD3',
556 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
557 Flags => 'SubIFD',
558 SubDirectory => {
559 TagTable => 'Image::ExifTool::Kodak::SubIFD3',
560 Start => '$val',
561 Base => '$start',
562 },
563 },
564 # (SubIFD4 has the pointer zeroed in my samples, but support it
565 # in case it is used by future models -- ignored if pointer is zero)
566 0xfc04 => {
567 Name => 'SubIFD4',
568 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
569 Flags => 'SubIFD',
570 SubDirectory => {
571 TagTable => 'Image::ExifTool::Kodak::SubIFD4',
572 Start => '$val',
573 Base => '$start',
574 },
575 },
576 0xfc05 => {
577 Name => 'SubIFD5',
578 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
579 Flags => 'SubIFD',
580 SubDirectory => {
581 TagTable => 'Image::ExifTool::Kodak::SubIFD5',
582 Start => '$val',
583 Base => '$start',
584 },
585 },
586 0xff00 => {
587 Name => 'CameraInfo',
588 Groups => { 1 => 'MakerNotes' }, # SubIFD needs group 1 set
589 Flags => 'SubIFD',
590 SubDirectory => {
591 TagTable => 'Image::ExifTool::Kodak::CameraInfo',
592 Start => '$val',
593 },
594 },
595);
596
597# Kodak SubIFD0 tags (ref PH)
598%Image::ExifTool::Kodak::SubIFD0 = (
599 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
600 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
601 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
602 NOTES => 'SubIFD0 through SubIFD5 tags are used by the Z612 and Z712.',
603 0xfa02 => {
604 Name => 'SceneMode',
605 Writable => 'int16u',
606 PrintConv => {
607 1 => 'Sport',
608 3 => 'Portrait',
609 4 => 'Landscape',
610 6 => 'Beach',
611 7 => 'Night Portrait',
612 8 => 'Night Landscape',
613 9 => 'Snow',
614 10 => 'Text',
615 11 => 'Fireworks',
616 12 => 'Macro',
617 13 => 'Museum',
618 16 => 'Children',
619 17 => 'Program',
620 18 => 'Aperture Priority',
621 19 => 'Shutter Priority',
622 20 => 'Manual',
623 25 => 'Back Light',
624 28 => 'Candlelight',
625 29 => 'Sunset',
626 31 => 'Panorama Left-Right',
627 32 => 'Panorama Right-Left',
628 33 => 'Smart Scene',
629 34 => 'High ISO',
630 },
631 },
632 # 0xfa04 - values: 0 (normally), 2 (panorama shots)
633 # 0xfa0f - values: 0 (normally), 1 (macro?)
634 # 0xfa11 - some sort of FNumber (x 100)
635 0xfa19 => {
636 Name => 'SerialNumber', # (verified with Z712 - PH)
637 Writable => 'string',
638 },
639 0xfa1d => {
640 Name => 'KodakImageWidth',
641 Writable => 'int16u',
642 },
643 0xfa1e => {
644 Name => 'KodakImageHeight',
645 Writable => 'int16u',
646 },
647 0xfa20 => {
648 Name => 'SensorWidth',
649 Writable => 'int16u',
650 },
651 0xfa21 => {
652 Name => 'SensorHeight',
653 Writable => 'int16u',
654 },
655 0xfa23 => {
656 Name => 'FNumber',
657 Writable => 'int16u',
658 Priority => 0,
659 ValueConv => '$val / 100',
660 ValueConvInv => '$val * 100',
661 },
662 0xfa24 => {
663 Name => 'ExposureTime',
664 Writable => 'int32u',
665 Priority => 0,
666 ValueConv => '$val / 1e5',
667 ValueConvInv => '$val * 1e5',
668 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
669 PrintConvInv => 'eval $val',
670 },
671 0xfa2e => {
672 Name => 'ISO',
673 Writable => 'int16u',
674 Priority => 0,
675 },
676 0xfa3d => {
677 Name => 'OpticalZoom',
678 Writable => 'int16u',
679 ValueConv => '$val / 100',
680 ValueConvInv => '$val * 100',
681 PrintConv => 'sprintf("%.2f",$val)',
682 PrintConvInv => '$val=~s/ ?x//; $val',
683 },
684 0xfa46 => {
685 Name => 'ISO',
686 Writable => 'int16u',
687 Priority => 0,
688 },
689 # 0xfa4c - related to focal length (1=wide, 32=full zoom)
690 0xfa51 => {
691 Name => 'KodakImageWidth',
692 Writable => 'int16u',
693 },
694 0xfa52 => {
695 Name => 'KodakImageHeight',
696 Writable => 'int16u',
697 },
698 0xfa54 => {
699 Name => 'ThumbnailWidth',
700 Writable => 'int16u',
701 },
702 0xfa55 => {
703 Name => 'ThumbnailHeight',
704 Writable => 'int16u',
705 },
706 0xfa57 => {
707 Name => 'PreviewWidth',
708 Writable => 'int16u',
709 },
710 0xfa58 => {
711 Name => 'PreviewHeight',
712 Writable => 'int16u',
713 },
714);
715
716# Kodak SubIFD1 tags (ref PH)
717%Image::ExifTool::Kodak::SubIFD1 = (
718 PROCESS_PROC => \&ProcessKodakIFD,
719 WRITE_PROC => \&WriteKodakIFD,
720 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
721 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
722 0x0027 => {
723 Name => 'ISO',
724 Writable => 'int16u',
725 Priority => 0,
726 },
727 0x0028 => {
728 Name => 'ISO',
729 Writable => 'int16u',
730 Priority => 0,
731 },
732);
733
734my %sceneModeUsed = (
735 0 => 'Program',
736 2 => 'Aperture Priority',
737 3 => 'Shutter Priority',
738 4 => 'Manual',
739 5 => 'Portrait',
740 6 => 'Sport',
741 7 => 'Children',
742 8 => 'Museum',
743 10 => 'High ISO',
744 11 => 'Text',
745 12 => 'Macro',
746 13 => 'Back Light',
747 16 => 'Landscape',
748 17 => 'Night Landscape',
749 18 => 'Night Portrait',
750 19 => 'Snow',
751 20 => 'Beach',
752 21 => 'Fireworks',
753 22 => 'Sunset',
754 23 => 'Candlelight',
755 28 => 'Panorama',
756);
757
758# Kodak SubIFD2 tags (ref PH)
759%Image::ExifTool::Kodak::SubIFD2 = (
760 PROCESS_PROC => \&ProcessKodakIFD,
761 WRITE_PROC => \&WriteKodakIFD,
762 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
763 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
764 0x6002 => {
765 Name => 'SceneModeUsed',
766 Writable => 'int32u',
767 PrintConv => \%sceneModeUsed,
768 },
769 0x6006 => {
770 Name => 'OpticalZoom',
771 Writable => 'int32u',
772 ValueConv => '$val / 100',
773 ValueConvInv => '$val * 100',
774 PrintConv => 'sprintf("%.2f",$val)',
775 PrintConvInv => '$val=~s/ ?x//; $val',
776 },
777 # 0x6009 - some sort of FNumber (x 100)
778 0x6103 => {
779 Name => 'MaxAperture',
780 Writable => 'int32u',
781 ValueConv => '$val / 100',
782 ValueConvInv => '$val * 100',
783 },
784 0xf002 => {
785 Name => 'SceneModeUsed',
786 Writable => 'int32u',
787 PrintConv => \%sceneModeUsed,
788 },
789 0xf006 => {
790 Name => 'OpticalZoom',
791 Writable => 'int32u',
792 ValueConv => '$val / 100',
793 ValueConvInv => '$val * 100',
794 PrintConv => 'sprintf("%.2f",$val)',
795 PrintConvInv => '$val=~s/ ?x//; $val',
796 },
797 # 0xf009 - some sort of FNumber (x 100)
798 0xf103 => {
799 Name => 'FNumber',
800 Writable => 'int32u',
801 Priority => 0,
802 ValueConv => '$val / 100',
803 ValueConvInv => '$val * 100',
804 },
805 0xf104 => {
806 Name => 'ExposureTime',
807 Writable => 'int32u',
808 Priority => 0,
809 ValueConv => '$val / 1e6',
810 ValueConvInv => '$val * 1e6',
811 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
812 PrintConvInv => 'eval $val',
813 },
814 0xf105 => {
815 Name => 'ISO',
816 Writable => 'int32u',
817 Priority => 0,
818 ValueConv => '$val / 10',
819 ValueConvInv => '$val * 10',
820 },
821);
822
823# Kodak SubIFD3 tags (ref PH)
824%Image::ExifTool::Kodak::SubIFD3 = (
825 PROCESS_PROC => \&ProcessKodakIFD,
826 WRITE_PROC => \&WriteKodakIFD,
827 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
828 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
829 0x1000 => {
830 Name => 'OpticalZoom',
831 Writable => 'int16u',
832 ValueConv => '$val / 100',
833 ValueConvInv => '$val * 100',
834 PrintConv => 'sprintf("%.2f",$val)',
835 PrintConvInv => '$val=~s/ ?x//; $val',
836 },
837 # 0x1002 - related to focal length (1=wide, 32=full zoom)
838 # 0x1006 - pictures remaining? (gradually decreases as pictures are taken)
839);
840
841# Kodak SubIFD4 tags (ref PH)
842%Image::ExifTool::Kodak::SubIFD4 = (
843 PROCESS_PROC => \&ProcessKodakIFD,
844 WRITE_PROC => \&WriteKodakIFD,
845 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
846 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
847);
848
849# Kodak SubIFD5 tags (ref PH)
850%Image::ExifTool::Kodak::SubIFD5 = (
851 PROCESS_PROC => \&ProcessKodakIFD,
852 WRITE_PROC => \&WriteKodakIFD,
853 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
854 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
855 0x000f => {
856 Name => 'OpticalZoom',
857 Writable => 'int16u',
858 ValueConv => '$val / 100',
859 ValueConvInv => '$val * 100',
860 PrintConv => 'sprintf("%.2f",$val)',
861 PrintConvInv => '$val=~s/ ?x//; $val',
862 },
863);
864
865# Decoded from P712, P850 and P880 samples (ref PH)
866%Image::ExifTool::Kodak::CameraInfo = (
867 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
868 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
869 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
870 NOTES => 'These tags are used by the P712, P850 and P880.',
871 0xf900 => {
872 Name => 'SensorWidth',
873 Writable => 'int16u',
874 Notes => 'effective sensor size',
875 },
876 0xf901 => {
877 Name => 'SensorHeight',
878 Writable => 'int16u',
879 },
880 0xf902 => {
881 Name => 'BayerPattern',
882 Writable => 'string',
883 },
884 0xf903 => {
885 Name => 'SensorFullWidth',
886 Writable => 'int16u',
887 Notes => 'includes black border?',
888 },
889 0xf904 => {
890 Name => 'SensorFullHeight',
891 Writable => 'int16u',
892 },
893 0xf907 => {
894 Name => 'KodakImageWidth',
895 Writable => 'int16u',
896 },
897 0xf908 => {
898 Name => 'KodakImageHeight',
899 Writable => 'int16u',
900 },
901 0xfa00 => {
902 Name => 'KodakInfoType',
903 Writable => 'string',
904 },
905 0xfa04 => {
906 Name => 'SerialNumber', # (unverified)
907 Writable => 'string',
908 },
909 0xfd04 => {
910 Name => 'FNumber',
911 Writable => 'int16u',
912 Priority => 0,
913 ValueConv => '$val / 100',
914 ValueConvInv => '$val * 100',
915 },
916 0xfd05 => {
917 Name => 'ExposureTime',
918 Writable => 'int32u',
919 Priority => 0,
920 ValueConv => '$val / 1e6',
921 ValueConvInv => '$val * 1e6',
922 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
923 PrintConvInv => 'eval $val',
924 },
925 0xfd06 => {
926 Name => 'ISO',
927 Writable => 'int16u',
928 Priority => 0,
929 },
930);
931
932# treat unknown maker notes as binary data (allows viewing with -U)
933%Image::ExifTool::Kodak::Unknown = (
934 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
935 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
936 FIRST_ENTRY => 0,
937);
938
939# Kodak APP3 "Meta" tags (ref 2)
940%Image::ExifTool::Kodak::Meta = (
941 GROUPS => { 0 => 'Meta', 1 => 'MetaIFD', 2 => 'Image'},
942 NOTES => q{
943 These tags are found in the APP3 "Meta" segment of JPEG images from Kodak
944 cameras such as the DC280, DC3400, DC5000 and MC3. The structure of this
945 segment is similar to the APP1 "Exif" segment, but a different set of tags
946 is used.
947 },
948 0xc350 => 'FilmProductCode',
949 0xc351 => 'ImageSourceEK',
950 0xc352 => 'CaptureConditionsPAR',
951 0xc353 => {
952 Name => 'CameraOwner',
953 PrintConv => 'Image::ExifTool::Exif::ConvertExifText($self,$val)',
954 },
955 0xc354 => {
956 Name => 'SerialNumber',
957 Groups => { 2 => 'Camera' },
958 },
959 0xc355 => 'UserSelectGroupTitle',
960 0xc356 => 'DealerIDNumber',
961 0xc357 => 'CaptureDeviceFID',
962 0xc358 => 'EnvelopeNumber',
963 0xc359 => 'FrameNumber',
964 0xc35a => 'FilmCategory',
965 0xc35b => 'FilmGencode',
966 0xc35c => 'ModelAndVersion',
967 0xc35d => 'FilmSize',
968 0xc35e => 'SBA_RGBShifts',
969 0xc35f => 'SBAInputImageColorspace',
970 0xc360 => 'SBAInputImageBitDepth',
971 0xc361 => 'SBAExposureRecord',
972 0xc362 => 'UserAdjSBA_RGBShifts',
973 0xc363 => 'ImageRotationStatus',
974 0xc364 => 'RollGuidElements',
975 0xc365 => 'MetadataNumber',
976 0xc366 => 'EditTagArray',
977 0xc367 => 'Magnification',
978 0xc36c => 'NativeXResolution',
979 0xc36d => 'NativeYResolution',
980 0xc36e => {
981 Name => 'KodakEffectsIFD',
982 Flags => 'SubIFD',
983 SubDirectory => {
984 TagTable => 'Image::ExifTool::Kodak::SpecialEffects',
985 Start => '$val',
986 },
987 },
988 0xc36f => {
989 Name => 'KodakBordersIFD',
990 Flags => 'SubIFD',
991 SubDirectory => {
992 TagTable => 'Image::ExifTool::Kodak::Borders',
993 Start => '$val',
994 },
995 },
996 0xc37a => 'NativeResolutionUnit',
997 0xc418 => 'SourceImageDirectory',
998 0xc419 => 'SourceImageFileName',
999 0xc41a => 'SourceImageVolumeName',
1000 0xc46c => 'PrintQuality',
1001 0xc46e => 'ImagePrintStatus',
1002);
1003
1004# Kodak APP3 "Meta" Special Effects sub-IFD (ref 2)
1005%Image::ExifTool::Kodak::SpecialEffects = (
1006 GROUPS => { 0 => 'Meta', 1 => 'KodakEffectsIFD', 2 => 'Image'},
1007 0 => 'DigitalEffectsVersion',
1008 1 => {
1009 Name => 'DigitalEffectsName',
1010 PrintConv => 'Image::ExifTool::Exif::ConvertExifText($self,$val)',
1011 },
1012 2 => 'DigitalEffectsType',
1013);
1014
1015# Kodak APP3 "Meta" Borders sub-IFD (ref 2)
1016%Image::ExifTool::Kodak::Borders = (
1017 GROUPS => { 0 => 'Meta', 1 => 'KodakBordersIFD', 2 => 'Image'},
1018 0 => 'BordersVersion',
1019 1 => {
1020 Name => 'BorderName',
1021 PrintConv => 'Image::ExifTool::Exif::ConvertExifText($self,$val)',
1022 },
1023 2 => 'BorderID',
1024 3 => 'BorderLocation',
1025 4 => 'BorderType',
1026 8 => 'WatermarkType',
1027);
1028
1029# Kodak composite tags
1030%Image::ExifTool::Kodak::Composite = (
1031 DateCreated => {
1032 Groups => { 2 => 'Time' },
1033 Require => {
1034 0 => 'Kodak:YearCreated',
1035 1 => 'Kodak:MonthDayCreated',
1036 },
1037 ValueConv => '"$val[0]:$val[1]"',
1038 },
1039);
1040
1041# add our composite tags
1042Image::ExifTool::AddCompositeTags('Image::ExifTool::Kodak');
1043
1044#------------------------------------------------------------------------------
1045# Process Kodak IFD (with leading byte order mark)
1046# Inputs: 0) ExifTool object ref, 1) dirInfo hash ref, 2) tag table ref
1047# Returns: 1 on success, otherwise returns 0 and sets a Warning
1048sub ProcessKodakIFD($$$)
1049{
1050 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
1051 my $dirStart = $$dirInfo{DirStart} || 0;
1052 return 1 if $dirStart <= 0 or $dirStart + 2 > $$dirInfo{DataLen};
1053 my $byteOrder = substr(${$$dirInfo{DataPt}}, $dirStart, 2);
1054 return 1 unless Image::ExifTool::SetByteOrder($byteOrder);
1055 $$dirInfo{DirStart} += 2; # skip byte order mark
1056 $$dirInfo{DirLen} -= 2;
1057 if ($exifTool->{HTML_DUMP}) {
1058 my $base = $$dirInfo{Base} + $$dirInfo{DataPos};
1059 $exifTool->HtmlDump($dirStart+$base, 2, "Byte Order Mark");
1060 }
1061 return Image::ExifTool::Exif::ProcessExif($exifTool, $dirInfo, $tagTablePtr);
1062}
1063
1064#------------------------------------------------------------------------------
1065# Write Kodak IFD (with leading byte order mark)
1066# Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
1067# Returns: Exif data block (may be empty if no Exif data) or undef on error
1068sub WriteKodakIFD($$$)
1069{
1070 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
1071 my $dirStart = $$dirInfo{DirStart} || 0;
1072 return '' if $dirStart <= 0 or $dirStart + 2 > $$dirInfo{DataLen};
1073 my $byteOrder = substr(${$$dirInfo{DataPt}}, $dirStart, 2);
1074 return '' unless Image::ExifTool::SetByteOrder($byteOrder);
1075 $$dirInfo{DirStart} += 2; # skip byte order mark
1076 $$dirInfo{DirLen} -= 2;
1077 my $buff = Image::ExifTool::Exif::WriteExif($exifTool, $dirInfo, $tagTablePtr);
1078 return $buff unless defined $buff and length $buff;
1079 # apply one-time fixup for length of byte order mark
1080 if ($$dirInfo{Fixup}) {
1081 $dirInfo->{Fixup}->{Shift} += 2;
1082 $$dirInfo{Fixup}->ApplyFixup(\$buff);
1083 delete $$dirInfo{Fixup};
1084 }
1085 return Image::ExifTool::GetByteOrder() . $buff;
1086}
1087
10881; # end
1089
1090__END__
1091
1092=head1 NAME
1093
1094Image::ExifTool::Kodak - Kodak EXIF maker notes and APP3 "Meta" tags
1095
1096=head1 SYNOPSIS
1097
1098This module is loaded automatically by Image::ExifTool when required.
1099
1100=head1 DESCRIPTION
1101
1102This module contains definitions required by Image::ExifTool to
1103interpret Kodak maker notes EXIF meta information.
1104
1105=head1 AUTHOR
1106
1107Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
1108
1109This library is free software; you can redistribute it and/or modify it
1110under the same terms as Perl itself.
1111
1112=head1 REFERENCES
1113
1114=over 4
1115
1116=item L<Image::MetaData::JPEG|Image::MetaData::JPEG>
1117
1118=item L<http://www.ozhiker.com/electronics/pjmt/jpeg_info/meta.html>
1119
1120=item (...plus lots of testing with my daughter's CX4200!)
1121
1122=back
1123
1124=head1 SEE ALSO
1125
1126L<Image::ExifTool::TagNames/Kodak Tags>,
1127L<Image::ExifTool(3pm)|Image::ExifTool>
1128
1129=cut
Note: See TracBrowser for help on using the repository browser.