source: gsdl/trunk/perllib/cpan/Image/ExifTool/Casio.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: 14.9 KB
Line 
1#------------------------------------------------------------------------------
2# File: Casio.pm
3#
4# Description: Casio EXIF maker notes tags
5#
6# Revisions: 12/09/2003 - P. Harvey Created
7# 09/10/2004 - P. Harvey Added MakerNote2 (thanks to Joachim Loehr)
8#
9# References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
10# 2) Joachim Loehr private communication
11# 3) http://homepage3.nifty.com/kamisaka/makernote/makernote_casio.htm
12# 4) http://www.gvsoft.homedns.org/exif/makernote-casio.html
13#------------------------------------------------------------------------------
14
15package Image::ExifTool::Casio;
16
17use strict;
18use vars qw($VERSION);
19use Image::ExifTool::Exif;
20
21$VERSION = '1.21';
22
23# older Casio maker notes (ref 1)
24%Image::ExifTool::Casio::Main = (
25 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
26 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
27 WRITABLE => 1,
28 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
29 0x0001 => {
30 Name => 'RecordingMode' ,
31 Writable => 'int16u',
32 PrintConv => {
33 1 => 'Single Shutter',
34 2 => 'Panorama',
35 3 => 'Night Scene',
36 4 => 'Portrait',
37 5 => 'Landscape',
38 7 => 'Panorama', #4
39 10 => 'Night Scene', #4
40 15 => 'Portrait', #4
41 16 => 'Landscape', #4
42 },
43 },
44 0x0002 => {
45 Name => 'Quality',
46 Writable => 'int16u',
47 PrintConv => { 1 => 'Economy', 2 => 'Normal', 3 => 'Fine' },
48 },
49 0x0003 => {
50 Name => 'FocusMode',
51 Writable => 'int16u',
52 PrintConv => {
53 2 => 'Macro',
54 3 => 'Auto',
55 4 => 'Manual',
56 5 => 'Infinity',
57 7 => 'Spot AF', #4
58 },
59 },
60 0x0004 => [
61 {
62 Name => 'FlashMode',
63 Condition => '$self->{CameraModel} =~ /^QV-(3500EX|8000SX)/',
64 Writable => 'int16u',
65 PrintConv => {
66 1 => 'Auto',
67 2 => 'On',
68 3 => 'Off',
69 4 => 'Off', #4
70 5 => 'Red-eye Reduction', #4
71 },
72 },
73 {
74 Name => 'FlashMode',
75 Writable => 'int16u',
76 PrintConv => {
77 1 => 'Auto',
78 2 => 'On',
79 3 => 'Off',
80 4 => 'Red-eye Reduction',
81 },
82 },
83 ],
84 0x0005 => {
85 Name => 'FlashIntensity',
86 Writable => 'int16u',
87 PrintConv => {
88 11 => 'Weak',
89 12 => 'Low', #4
90 13 => 'Normal',
91 14 => 'High', #4
92 15 => 'Strong',
93 },
94 },
95 0x0006 => {
96 Name => 'ObjectDistance',
97 Writable => 'int32u',
98 ValueConv => '$val / 1000', #4
99 ValueConvInv => '$val * 1000',
100 PrintConv => '"$val m"',
101 PrintConvInv => '$val=~s/\s*m$//;$val',
102 },
103 0x0007 => {
104 Name => 'WhiteBalance',
105 Writable => 'int16u',
106 PrintConv => {
107 1 => 'Auto',
108 2 => 'Tungsten',
109 3 => 'Daylight',
110 4 => 'Fluorescent',
111 5 => 'Shade',
112 129 => 'Manual',
113 },
114 },
115 # 0x0009 Bulb? (ref unknown)
116 0x000a => {
117 Name => 'DigitalZoom',
118 Writable => 'int32u',
119 PrintHex => 1,
120 PrintConv => {
121 0x10000 => 'Off',
122 0x10001 => '2x',
123 0x19999 => '1.6x', #4
124 0x20000 => '2x', #4
125 0x33333 => '3.2x', #4
126 0x40000 => '4x', #4
127 },
128 },
129 0x000b => {
130 Name => 'Sharpness',
131 Writable => 'int16u',
132 PrintConv => {
133 0 => 'Normal',
134 1 => 'Soft',
135 2 => 'Hard',
136 16 => 'Normal', #4
137 17 => '+1', #4
138 18 => '-1', #4
139 },
140 },
141 0x000c => {
142 Name => 'Contrast',
143 Writable => 'int16u',
144 PrintConv => {
145 0 => 'Normal',
146 1 => 'Low',
147 2 => 'High',
148 16 => 'Normal', #4
149 17 => '+1', #4
150 18 => '-1', #4
151 },
152 },
153 0x000d => {
154 Name => 'Saturation',
155 Writable => 'int16u',
156 PrintConv => {
157 0 => 'Normal',
158 1 => 'Low',
159 2 => 'High',
160 16 => 'Normal', #4
161 17 => '+1', #4
162 18 => '-1', #4
163 },
164 },
165 0x0014 => {
166 Name => 'ISO',
167 Writable => 'int16u',
168 Priority => 0,
169 },
170 0x0016 => { #4
171 Name => 'Enhancement',
172 Writable => 'int16u',
173 PrintConv => {
174 1 => 'Off',
175 2 => 'Red',
176 3 => 'Green',
177 4 => 'Blue',
178 5 => 'Flesh Tones',
179 },
180 },
181 0x0017 => { #4
182 Name => 'ColorFilter',
183 Writable => 'int16u',
184 PrintConv => {
185 1 => 'Off',
186 2 => 'Black & White',
187 3 => 'Sepia',
188 4 => 'Red',
189 5 => 'Green',
190 6 => 'Blue',
191 7 => 'Yellow',
192 8 => 'Pink',
193 9 => 'Purple',
194 },
195 },
196 0x0018 => { #4
197 Name => 'AFPoint',
198 Writable => 'int16u',
199 PrintConv => {
200 1 => 'Center',
201 2 => 'Upper Left',
202 3 => 'Upper Right',
203 4 => 'Near Left/Right of Center',
204 5 => 'Far Left/Right of Center',
205 6 => 'Far Left/Right of Center/Bottom',
206 7 => 'Top Near-Left',
207 8 => 'Near Upper/Left',
208 9 => 'Top Near-Right',
209 10 => 'Top Left',
210 11 => 'Top Center',
211 12 => 'Top Right',
212 13 => 'Center Left',
213 14 => 'Center Right',
214 15 => 'Bottom Left',
215 16 => 'Bottom Center',
216 17 => 'Bottom Right',
217 },
218 },
219 0x0019 => { #4
220 Name => 'FlashIntensity',
221 Writable => 'int16u',
222 PrintConv => {
223 1 => 'Normal',
224 2 => 'Weak',
225 3 => 'Strong',
226 },
227 },
228 0x0e00 => {
229 Name => 'PrintIM',
230 Description => 'Print Image Matching',
231 # crazy I know, but the offset for this value is entry-based
232 # (QV-2100, QV-2900UX, QV-3500EX and QV-4000) even though the
233 # offsets for other values isn't
234 EntryBased => 1,
235 SubDirectory => {
236 TagTable => 'Image::ExifTool::PrintIM::Main',
237 },
238 },
239);
240
241# ref 2:
242%Image::ExifTool::Casio::Type2 = (
243 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
244 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
245 WRITABLE => 1,
246 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
247 0x0002 => {
248 Name => 'PreviewImageSize',
249 Groups => { 2 => 'Image' },
250 Writable => 'int16u',
251 Count => 2,
252 PrintConv => '$val =~ tr/ /x/; $val',
253 PrintConvInv => '$val =~ tr/x/ /; $val',
254 },
255 0x0003 => {
256 Name => 'PreviewImageLength',
257 Groups => { 2 => 'Image' },
258 OffsetPair => 0x0004, # point to associated offset
259 DataTag => 'PreviewImage',
260 Writable => 'int32u',
261 Protected => 2,
262 },
263 0x0004 => {
264 Name => 'PreviewImageStart',
265 Groups => { 2 => 'Image' },
266 Flags => 'IsOffset',
267 OffsetPair => 0x0003, # point to associated byte count
268 DataTag => 'PreviewImage',
269 Writable => 'int32u',
270 Protected => 2,
271 },
272 0x0008 => {
273 Name => 'QualityMode',
274 Writable => 'int16u',
275 PrintConv => {
276 0 => 'Economy',
277 1 => 'Normal',
278 2 => 'Fine',
279 },
280 },
281 0x0009 => {
282 Name => 'CasioImageSize',
283 Groups => { 2 => 'Image' },
284 Writable => 'int16u',
285 PrintConv => {
286 0 => '640x480',
287 4 => '1600x1200',
288 5 => '2048x1536',
289 20 => '2288x1712',
290 21 => '2592x1944',
291 22 => '2304x1728',
292 36 => '3008x2008',
293 },
294 },
295 0x000d => {
296 Name => 'FocusMode',
297 Writable => 'int16u',
298 PrintConv => {
299 0 => 'Normal',
300 1 => 'Macro',
301 },
302 },
303 0x0014 => {
304 Name => 'ISO',
305 Writable => 'int16u',
306 Priority => 0,
307 PrintConv => {
308 3 => 50,
309 4 => 64,
310 6 => 100,
311 9 => 200,
312 },
313 },
314 0x0019 => {
315 Name => 'WhiteBalance',
316 Writable => 'int16u',
317 PrintConv => {
318 0 => 'Auto',
319 1 => 'Daylight',
320 2 => 'Shade',
321 3 => 'Tungsten',
322 4 => 'Fluorescent',
323 5 => 'Manual',
324 },
325 },
326 0x001d => {
327 Name => 'FocalLength',
328 Writable => 'rational64u',
329 PrintConv => 'sprintf("%.1fmm",$val)',
330 PrintConvInv => '$val=~s/mm$//;$val',
331 },
332 0x001f => {
333 Name => 'Saturation',
334 Writable => 'int16u',
335 PrintConv => {
336 0 => 'Low',
337 1 => 'Normal',
338 2 => 'High',
339 },
340 },
341 0x0020 => {
342 Name => 'Contrast',
343 Writable => 'int16u',
344 PrintConv => {
345 0 => 'Low',
346 1 => 'Normal',
347 2 => 'High',
348 },
349 },
350 0x0021 => {
351 Name => 'Sharpness',
352 Writable => 'int16u',
353 PrintConv => {
354 0 => 'Soft',
355 1 => 'Normal',
356 2 => 'Hard',
357 },
358 },
359 0x0e00 => {
360 Name => 'PrintIM',
361 Description => 'Print Image Matching',
362 Writable => 0,
363 SubDirectory => {
364 TagTable => 'Image::ExifTool::PrintIM::Main',
365 },
366 },
367 0x2000 => {
368 # this image data is also referenced by tags 3 and 4
369 # (nasty that they double-reference the image!)
370 %Image::ExifTool::previewImageTagInfo,
371 },
372 0x2001 => { #PH
373 # I downloaded images from 12 different EX-Z50 cameras, and they showed
374 # only 3 distinct dates here (2004:08:31 18:55, 2004:09:13 14:14, and
375 # 2004:11:26 17:07), so I'm guessing this is a firmware version date - PH
376 Name => 'FirmwareDate',
377 Writable => 'string',
378 Format => 'undef', # the 'string' contains nulls
379 Count => 18,
380 PrintConv => q{
381 $_ = $val;
382 if (/^(\d{2})(\d{2})\0\0(\d{2})(\d{2})\0\0(\d{2})\0{4}$/) {
383 my $yr = $1 + ($1 < 70 ? 2000 : 1900);
384 return "$yr:$2:$3 $4:$5";
385 }
386 tr/\0/./; s/\.+$//;
387 return "Unknown ($_)";
388 },
389 PrintConvInv => q{
390 $_ = $val;
391 if (/^(19|20)(\d{2}):(\d{2}):(\d{2}) (\d{2}):(\d{2})$/) {
392 return "$2$3\0\0$4$5\0\0$6\0\0\0\0";
393 } elsif (/^Unknown\s*\((.*)\)$/i) {
394 $_ = $1; tr/./\0/;
395 return $_;
396 } else {
397 return undef;
398 }
399 },
400 },
401 0x2011 => {
402 Name => 'WhiteBalanceBias',
403 Writable => 'int16u',
404 Count => 2,
405 },
406 0x2012 => {
407 Name => 'WhiteBalance',
408 Writable => 'int16u',
409 PrintConv => {
410 0 => 'Manual',
411 1 => 'Daylight', #3
412 3 => 'Shade', #3
413 4 => 'Flash?',
414 6 => 'Fluorescent', #3
415 10 => 'Tungsten', #3
416 12 => 'Flash',
417 },
418 },
419 0x2022 => {
420 Name => 'ObjectDistance',
421 Writable => 'int32u',
422 ValueConv => '$val >= 0x20000000 ? "inf" : $val / 1000',
423 ValueConvInv => '$val eq "inf" ? 0x20000000 : $val * 1000',
424 PrintConv => '$val eq "inf" ? $val : "$val m"',
425 PrintConvInv => '$val=~s/\s*m$//;$val',
426 },
427 # 0x2023 looks interesting (values 0,1,2,3,5 in samples) - PH
428 0x2034 => {
429 Name => 'FlashDistance',
430 Writable => 'int16u',
431 },
432 0x3000 => {
433 Name => 'RecordMode',
434 Writable => 'int16u',
435 PrintConv => {
436 2 => 'Program AE', #3
437 3 => 'Shutter Priority', #3
438 4 => 'Aperture Priority', #3
439 5 => 'Manual', #3
440 6 => 'Best Shot', #3
441 },
442 },
443 # 0x3001 is ShutterMode according to ref 3!
444 0x3001 => {
445 Name => 'SelfTimer',
446 Writable => 'int16u',
447 PrintConv => { 1 => 'Off' },
448 },
449 0x3002 => {
450 Name => 'Quality',
451 Writable => 'int16u',
452 PrintConv => {
453 1 => 'Economy',
454 2 => 'Normal',
455 3 => 'Fine',
456 },
457 },
458 0x3003 => {
459 Name => 'FocusMode',
460 Writable => 'int16u',
461 PrintConv => {
462 0 => 'Manual?',
463 1 => 'Fixation?',
464 2 => 'Macro', #3
465 3 => 'Single-Area Auto Focus',
466 6 => 'Multi-Area Auto Focus',
467 },
468 },
469 0x3006 => {
470 Name => 'HometownCity',
471 Writable => 'string',
472 },
473 0x3007 => {
474 Name => 'BestShotMode',
475 Writable => 'int16u',
476 PrintConv => {
477 0 => 'Off',
478 1 => 'On?',
479 },
480 },
481 0x3008 => { #3
482 Name => 'AutoISO',
483 Writable => 'int16u',
484 PrintConv => { 1 => 'On', 2 => 'Off' },
485 },
486 0x3011 => { #3
487 Name => 'Sharpness',
488 Format => 'int16s',
489 Writable => 'undef',
490 },
491 0x3012 => { #3
492 Name => 'Contrast',
493 Format => 'int16s',
494 Writable => 'undef',
495 },
496 0x3013 => { #3
497 Name => 'Saturation',
498 Format => 'int16s',
499 Writable => 'undef',
500 },
501 0x3014 => {
502 Name => 'ISO',
503 Writable => 'int16u',
504 Priority => 0,
505 },
506 0x3015 => {
507 Name => 'ColorMode',
508 Writable => 'int16u',
509 PrintConv => { 0 => 'Off' },
510 },
511 0x3016 => {
512 Name => 'Enhancement',
513 Writable => 'int16u',
514 PrintConv => { 0 => 'Off' },
515 },
516 0x3017 => {
517 Name => 'Filter',
518 Writable => 'int16u',
519 PrintConv => { 0 => 'Off' },
520 },
521 0x301c => { #3
522 Name => 'SequenceNumber', # for continuous shooting
523 Writable => 'int16u',
524 },
525 0x301d => { #3
526 Name => 'BracketSequence',
527 Writable => 'int16u',
528 Count => 2,
529 },
530 # 0x301e - MultiBracket ? (ref 3)
531 0x3020 => { #3
532 Name => 'ImageStabilization',
533 Writable => 'int16u',
534 PrintConv => {
535 0 => 'Off',
536 1 => 'On',
537 2 => 'Best Shot',
538 },
539 },
540);
541
5421; # end
543
544__END__
545
546=head1 NAME
547
548Image::ExifTool::Casio - Casio EXIF maker notes tags
549
550=head1 SYNOPSIS
551
552This module is loaded automatically by Image::ExifTool when required.
553
554=head1 DESCRIPTION
555
556This module contains definitions required by Image::ExifTool to interpret
557Casio maker notes in EXIF information.
558
559=head1 AUTHOR
560
561Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
562
563This library is free software; you can redistribute it and/or modify it
564under the same terms as Perl itself.
565
566=head1 REFERENCES
567
568=over 4
569
570=item L<http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html>
571
572=back
573
574=head1 ACKNOWLEDGEMENTS
575
576Thanks to Joachim Loehr for adding support for the type 2 maker notes.
577
578=head1 SEE ALSO
579
580L<Image::ExifTool::TagNames/Casio Tags>,
581L<Image::ExifTool(3pm)|Image::ExifTool>
582
583=cut
Note: See TracBrowser for help on using the repository browser.