~ubuntu-branches/ubuntu/karmic/libimage-exiftool-perl/karmic

« back to all changes in this revision

Viewing changes to lib/Image/ExifTool/Panasonic.pm

  • Committer: Bazaar Package Importer
  • Author(s): Mari Wang
  • Date: 2008-02-04 20:32:53 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080204203253-mpbal8trlfe1fz5d
Tags: 7.00-1
* Upload of new production release (Closes: #456430)
* Added Recommends: libcompress-zlib-perl (Closes: #435589)
* Package now includes iptc2xmp.args and xmp2iptc.args, they are put
  into /usr/share/libimage-exiftool/ (Closes: #436100)
* Updated standards-version (3.7.2 -> 3.7.3). No changes needed.
* Lots of updates and bugfixes compared to last debian version
  (6.90).  See the Changes file for details
* Upload sponsored by Petter Reinholdtsen

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
use vars qw($VERSION);
24
24
use Image::ExifTool::Exif;
25
25
 
26
 
$VERSION = '1.21';
 
26
$VERSION = '1.26';
27
27
 
28
28
sub ProcessPanasonicType2($$$);
29
29
 
 
30
# conversions for ShootingMode and SceneMode
 
31
my %shootingMode = (
 
32
    1  => 'Normal',
 
33
    2  => 'Portrait',
 
34
    3  => 'Scenery',
 
35
    4  => 'Sports',
 
36
    5  => 'Night Portrait',
 
37
    6  => 'Program',
 
38
    7  => 'Aperture Priority',
 
39
    8  => 'Shutter Priority',
 
40
    9  => 'Macro',
 
41
    11 => 'Manual',
 
42
    12 => 'Movie Preview', #PH (LZ6)
 
43
    13 => 'Panning',
 
44
    14 => 'Simple', #PH (LZ6)
 
45
    18 => 'Fireworks',
 
46
    19 => 'Party',
 
47
    20 => 'Snow',
 
48
    21 => 'Night Scenery',
 
49
    22 => 'Food', #7
 
50
    23 => 'Baby', #10
 
51
    24 => 'Soft Skin', #PH (LZ6)
 
52
    25 => 'Candlelight', #PH (LZ6)
 
53
    26 => 'Starry Night', #PH (LZ6)
 
54
    27 => 'High Sensitivity', #7 (LZ6)
 
55
    29 => 'Underwater', #7
 
56
    30 => 'Beach', #PH (LZ6)
 
57
    31 => 'Aerial Photo', #PH (LZ6)
 
58
    32 => 'Sunset', #PH (LZ6)
 
59
    33 => 'Pet', #10
 
60
    34 => 'Intelligent ISO', #PH (LZ6)
 
61
);
 
62
 
30
63
%Image::ExifTool::Panasonic::Main = (
31
64
    WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
32
65
    CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
40
73
            3 => 'Normal',
41
74
            6 => 'Very High', #3 (Leica)
42
75
            7 => 'Raw', #3 (Leica)
 
76
            9 => 'Motion Picture', #PH (LZ6)
43
77
        },
44
78
    },
45
79
    0x02 => {
46
 
        Name => 'ProductionVersion',
47
 
        Format => 'int8u',  # (format type is 'undef', but it should really be int8u)
48
 
        Writable => 'int8u',
49
 
        Count => 4,
50
 
        PrintConv => '$_=$val; tr/ /./; $_',
51
 
        PrintConvInv => '$_=$val; tr/./ /; $_',
 
80
        Name => 'FirmwareVersion',
 
81
        Writable => 'undef',
 
82
        Notes => q{
 
83
            for some camera models such as the FZ30 this may be an internal production
 
84
            reference number and not the actual firmware version
 
85
        }, # (ref http://www.stevesforums.com/forums/view_topic.php?id=87764&forum_id=23&)
 
86
        # (can be either binary or ascii -- add decimal points if binary)
 
87
        ValueConv => '$val=~/[\0-\x2f]/ ? join(" ",unpack("C*",$val)) : $val',
 
88
        ValueConvInv => q{
 
89
            $val =~ /(\d+ ){3}\d+/ and $val = pack('C*',split(' ', $val));
 
90
            length($val) == 4 or warn "Version must be 4 numbers\n";
 
91
            return $val;
 
92
        },
 
93
        PrintConv => '$val=~tr/ /./; $val',
 
94
        PrintConvInv => '$val=~tr/./ /; $val',
52
95
    },
53
96
    0x03 => {
54
97
        Name => 'WhiteBalance',
93
136
        },
94
137
    },
95
138
    0x1a => {
96
 
        Name => 'ImageStabilizer',
 
139
        Name => 'ImageStabilization',
97
140
        Writable => 'int16u',
98
141
        PrintConv => {
99
142
            2 => 'On, Mode 1',
113
156
    0x1f => {
114
157
        Name => 'ShootingMode',
115
158
        Writable => 'int16u',
116
 
        PrintConv => {
117
 
            1  => 'Normal',
118
 
            2  => 'Portrait',
119
 
            3  => 'Scenery',
120
 
            4  => 'Sports',
121
 
            5  => 'Night Portrait',
122
 
            6  => 'Program',
123
 
            7  => 'Aperture Priority',
124
 
            8  => 'Shutter Priority',
125
 
            9  => 'Macro',
126
 
            11 => 'Manual',
127
 
            13 => 'Panning',
128
 
            18 => 'Fireworks',
129
 
            19 => 'Party',
130
 
            20 => 'Snow',
131
 
            21 => 'Night Scenery',
132
 
            22 => 'Food', #7
133
 
            23 => 'Baby', #10
134
 
            27 => 'High Sensitivity', #7
135
 
            29 => 'Underwater', #7
136
 
            33 => 'Pet', #10
137
 
        },
 
159
        PrintConv => \%shootingMode,
138
160
    },
139
161
    0x20 => {
140
162
        Name => 'Audio',
146
168
        Writable => 0,
147
169
        Binary => 1,
148
170
    },
 
171
    # 0x22 - normally 0, but 2 for 'Simple' ShootingMode in LZ6 sample - PH
149
172
    0x23 => {
150
173
        Name => 'WhiteBalanceBias',
151
174
        Format => 'int16s',
175
198
        },
176
199
        PrintConvInv => '$_=$val; tr/A-Z0-9//dc; s/(.{3})(19|20)/$1/; $_',
177
200
    },
 
201
    0x26 => { #PH
 
202
        Name => 'PanasonicExifVersion',
 
203
        Writable => 'undef',
 
204
    },
 
205
    # 0x27 - values: 0 (LZ6,FX10K)
178
206
    0x28 => {
179
207
        Name => 'ColorEffect',
180
208
        Writable => 'int16u',
187
215
            5 => 'Sepia',
188
216
        },
189
217
    },
190
 
    # 0x29 => 'SubjectDistance?',
 
218
    0x29 => { #10
 
219
        Name => 'TimeSincePowerOn',
 
220
        Writable => 'int32u',
 
221
        Notes => q{
 
222
            time in 1/100 sec from when the camera was powered on to when the image is
 
223
            written to memory card
 
224
        },
 
225
        ValueConv => '$val / 100',
 
226
        ValueConvInv => '$val * 100',
 
227
        PrintConv => sub { # convert to format "[DD days ]HH:MM:SS.ss"
 
228
            my $val = shift;
 
229
            my $str = '';
 
230
            if ($val >= 24 * 3600) {
 
231
                my $d = int($val / (24 * 3600));
 
232
                $str .= "$d days ";
 
233
                $val -= $d * 24 * 3600;
 
234
            }
 
235
            my $h = int($val / 3600);
 
236
            $val -= $h * 3600;
 
237
            my $m = int($val / 60);
 
238
            $val -= $m * 60;
 
239
            my $s = int($val);
 
240
            my $f = 100 * ($val - int($val));
 
241
            return sprintf("%s%.2d:%.2d:%.2d.%.2d",$str,$h,$m,$s,$f);
 
242
        },
 
243
        PrintConvInv => sub {
 
244
            my $val = shift;
 
245
            my @vals = ($val =~ /\d+(?:\.\d*)?/g);
 
246
            my $sec = 0;
 
247
            $sec += 24 * 3600 * shift(@vals) if @vals > 3;
 
248
            $sec += 3600 * shift(@vals) if @vals > 2;
 
249
            $sec += 60 * shift(@vals) if @vals > 1;
 
250
            $sec += shift(@vals) if @vals;
 
251
            return $sec;
 
252
        },
 
253
    },
191
254
    0x2a => { #4
192
255
        Name => 'BurstMode',
193
256
        Writable => 'int16u',
201
264
        Name => 'SequenceNumber',
202
265
        Writable => 'int32u',
203
266
    },
204
 
    0x2e => { #4
205
 
        Name => 'SelfTimer',
206
 
        Writable => 'int16u',
207
 
        PrintConv => {
208
 
            1 => 'Off',
209
 
            2 => '10s',
210
 
            3 => '2s',
211
 
        },
212
 
    },
213
267
    0x2c => {
214
268
        Name => 'Contrast',
215
269
        Flags => 'PrintHex',
218
272
            0 => 'Normal',
219
273
            1 => 'Low',
220
274
            2 => 'High',
 
275
            # 3 - observed with LZ6 in "Aerial Photo" mode - PH
 
276
            # 5 - observed with FX10 in "Underwater" mode - PH
221
277
            0x100 => 'Low',
222
278
            0x110 => 'Normal',
223
279
            0x120 => 'High',
232
288
            2 => 'High',
233
289
        },
234
290
    },
 
291
    0x2e => { #4
 
292
        Name => 'SelfTimer',
 
293
        Writable => 'int16u',
 
294
        PrintConv => {
 
295
            1 => 'Off',
 
296
            2 => '10s',
 
297
            3 => '2s',
 
298
        },
 
299
    },
 
300
    # 0x2f - values: 1 (LZ6,FX10K)
235
301
    0x30 => { #7
236
302
        Name => 'Rotation',
237
303
        Writable => 'int16u',
241
307
            8 => 'Rotate 270 CW', #PH (ref 7 gives 90 CW)
242
308
        },
243
309
    },
 
310
    # 0x31 - values: 1-5 some sort of mode? (changes with FOC-L) (PH/10)
244
311
    0x32 => { #7
245
312
        Name => 'ColorMode',
246
313
        Writable => 'int16u',
247
314
        PrintConv => {
248
315
            0 => 'Normal',
249
316
            1 => 'Natural',
 
317
            # 2 => observed in LZ6 for some shooting modes
250
318
        },
251
319
    },
252
 
    0x033 => { #10
 
320
    0x33 => { #10
253
321
        Name => 'BabyAge',
254
322
        Writable => 'string',
 
323
        Notes => 'or pet age', #PH
255
324
        PrintConv => '$val eq "9999:99:99 00:00:00" ? "(not set)" : $val',
256
325
        PrintConvInv => '$val =~ /^\d/ ? $val : "9999:99:99 00:00:00"',
257
326
    },
258
 
    # 0x33 - RedModeBirthday? (ref 7)
259
 
    # 0x34 - OpticalZoom? (1=standardZoom, 2-EXOpticsZoom) (ref 7)
 
327
    0x34 => { #7/PH
 
328
        Name => 'OpticalZoomMode',
 
329
        Writable => 'int16u',
 
330
        PrintConv => {
 
331
            1 => 'Standard',
 
332
            2 => 'EX Optics',
 
333
        },
 
334
    },
260
335
    0x35 => { #9
261
336
        Name => 'ConversionLens',
262
337
        Writable => 'int16u',
273
348
        PrintConv => '$val == 65535 ? "n/a" : $val',
274
349
        PrintConvInv => '$val =~ /(\d+)/ ? $1 : $val',
275
350
    },
 
351
    # 0x37 - values: 0,1,2 (LZ6, 0 for movie preview) and 257 (FX10K)
 
352
    # 0x38 - values: 0,1,2 (LZ6, same as 0x37) and 1,2 (FX10K)
 
353
    0x3a => {
 
354
        Name => 'WorldTimeLocation',
 
355
        Writable => 'int16u',
 
356
        PrintConv => {
 
357
            1 => 'Home',
 
358
            2 => 'Destination',
 
359
        },
 
360
    },
 
361
    # 0x3b - values: 1 (LZ6, FX10K)
 
362
    0x3c => { #PH
 
363
        Name => 'ProgramISO',
 
364
        Writable => 'int16u',
 
365
        PrintConv => '$val == 65535 ? "n/a" : $val',
 
366
        PrintConvInv => '$val eq "n/a" ? 65535 : $val',
 
367
    },
276
368
    # 0x40 Chroma? (ref 7)
277
369
    0x42 => { #7 (DMC-L1)
278
370
        Name => 'FilmMode',
289
381
            # 9 => 'My Film 2'?
290
382
        },
291
383
    },
 
384
    0x46 => { #PH/10
 
385
        Name => 'WBAdjustAB',
 
386
        Format => 'int16s',
 
387
        Writable => 'int16u',
 
388
        Notes => 'positive is a shift toward blue',
 
389
    },
 
390
    0x47 => { #PH/10
 
391
        Name => 'WBAdjustGM',
 
392
        Format => 'int16s',
 
393
        Writable => 'int16u',
 
394
        Notes => 'positive is a shift toward green',
 
395
    },
292
396
    0x51 => {
293
397
        Name => 'LensType',
294
398
        Writable => 'string',
309
413
            TagTable => 'Image::ExifTool::PrintIM::Main',
310
414
        },
311
415
    },
312
 
    # 0x8001 SceneMode? (ref 7)
313
 
    # 0x8010 TravelTime? (ref 7)
 
416
    0x8000 => { #PH
 
417
        Name => 'MakerNoteVersion',
 
418
        Format => 'undef',
 
419
    },
 
420
    0x8001 => { #7/PH/10
 
421
        Name => 'SceneMode',
 
422
        Writable => 'int16u',
 
423
        PrintConv => {
 
424
            0  => 'Off',
 
425
            %shootingMode,
 
426
        },
 
427
    },
 
428
    # 0x8002 - values: 1,2 related to focus? (PH/10)
 
429
    # 0x8003 - values: 1,2 related to focus? (PH/10)
 
430
    0x8004 => { #PH/10
 
431
        Name => 'WBRedLevel',
 
432
        Writable => 'int16u',
 
433
    },
 
434
    0x8005 => { #PH/10
 
435
        Name => 'WBGreenLevel',
 
436
        Writable => 'int16u',
 
437
    },
 
438
    0x8006 => { #PH/10
 
439
        Name => 'WBBlueLevel',
 
440
        Writable => 'int16u',
 
441
    },
 
442
    # 0x8007 - values: 1,2
 
443
    0x8010 => { #PH
 
444
        Name => 'BabyAge',
 
445
        Writable => 'string',
 
446
        Notes => 'or pet age',
 
447
        PrintConv => '$val eq "9999:99:99 00:00:00" ? "(not set)" : $val',
 
448
        PrintConvInv => '$val =~ /^\d/ ? $val : "9999:99:99 00:00:00"',
 
449
    },
314
450
);
315
451
 
316
452
# Type 2 tags (ref PH)
325
461
        iPalm.
326
462
    },
327
463
    0 => {
328
 
        Name => 'MakerNoteVersion',
 
464
        Name => 'MakerNoteType',
329
465
        Format => 'string[4]',
330
466
    },
331
467
    # seems to vary inversely with amount of light, so I'll call it 'Gain' - PH
346
482
    },
347
483
    0x02 => 'SensorWidth', #5/PH
348
484
    0x03 => 'SensorHeight', #5/PH
 
485
    0x04 => 'SensorTopBorder', #10
 
486
    0x05 => 'SensorLeftBorder', #10
349
487
    0x06 => 'ImageHeight', #5/PH
350
488
    0x07 => 'ImageWidth', #5/PH
 
489
    0x11 => { #10
 
490
        Name => 'RedBalance',
 
491
        Writable => 'int16u',
 
492
        ValueConv => '$val / 256',
 
493
        ValueConvInv => 'int($val * 256 + 0.5)',
 
494
        Notes => 'found in Digilux 2 RAW images',
 
495
    },
 
496
    0x12 => { #10
 
497
        Name => 'BlueBalance',
 
498
        Writable => 'int16u',
 
499
        ValueConv => '$val / 256',
 
500
        ValueConvInv => 'int($val * 256 + 0.5)',
 
501
    },
351
502
    0x17 => { #5
352
503
        Name => 'ISO',
353
504
        Writable => 'int16u',
354
505
    },
355
506
    0x24 => { #6
356
 
        Name => 'WB_RedLevel',
 
507
        Name => 'WBRedLevel',
357
508
        Writable => 'int16u',
358
509
    },
359
510
    0x25 => { #6
360
 
        Name => 'WB_GreenLevel',
 
511
        Name => 'WBGreenLevel',
361
512
        Writable => 'int16u',
362
513
    },
363
514
    0x26 => { #6
364
 
        Name => 'WB_BlueLevel',
 
515
        Name => 'WBBlueLevel',
365
516
        Writable => 'int16u',
366
517
    },
367
518
    0x10f => {
412
563
            Start => '$val',
413
564
        },
414
565
    },
 
566
    0x8825 => {
 
567
        Name => 'GPSInfo',
 
568
        Groups => { 1 => 'GPS' },
 
569
        Flags => 'SubIFD',
 
570
        SubDirectory => {
 
571
            DirName => 'GPS',
 
572
            TagTable => 'Image::ExifTool::GPS::Main',
 
573
            Start => '$val',
 
574
        },
 
575
    },
415
576
);
416
577
 
417
578
1;  # end