source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/KyoceraRaw.pm@ 24107

Last change on this file since 24107 was 24107, checked in by sjm84, 13 years ago

Updating the ExifTool perl modules

File size: 4.3 KB
Line 
1#------------------------------------------------------------------------------
2# File: KyoceraRaw.pm
3#
4# Description: Read Kyocera RAW meta information
5#
6# Revisions: 02/17/2006 - P. Harvey Created
7#
8# References: 1) http://www.cybercom.net/~dcoffin/dcraw/
9#------------------------------------------------------------------------------
10
11package Image::ExifTool::KyoceraRaw;
12
13use strict;
14use vars qw($VERSION);
15use Image::ExifTool qw(:DataAccess :Utils);
16
17$VERSION = '1.02';
18
19sub ProcessRAW($$);
20
21# utility to reverse order of characters in a string
22sub ReverseString($) { pack('C*',reverse unpack('C*',shift)) }
23
24# Contax N Digital tags (ref PH)
25%Image::ExifTool::KyoceraRaw::Main = (
26 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
27 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
28 NOTES => 'Tags for Kyocera Contax N Digital RAW images.',
29 0x01 => {
30 Name => 'FirmwareVersion',
31 Format => 'string[10]',
32 ValueConv => \&ReverseString,
33 },
34 0x0c => {
35 Name => 'Model',
36 Format => 'string[12]',
37 ValueConv => \&ReverseString,
38 },
39 0x19 => { #1
40 Name => 'Make',
41 Format => 'string[7]',
42 ValueConv => \&ReverseString,
43 },
44 0x21 => { #1
45 Name => 'DateTimeOriginal',
46 Description => 'Date/Time Original',
47 Groups => { 2 => 'Time' },
48 Format => 'string[20]',
49 ValueConv => \&ReverseString,
50 PrintConv => '$self->ConvertDateTime($val)',
51 },
52 0x34 => {
53 Name => 'ISO',
54 Groups => { 2 => 'Image' },
55 Format => 'int32u',
56 PrintConv => {
57 7 => 25,
58 8 => 32,
59 9 => 40,
60 10 => 50,
61 11 => 64,
62 12 => 80,
63 13 => 100,
64 14 => 125,
65 15 => 160,
66 16 => 200,
67 17 => 250,
68 18 => 320,
69 19 => 400,
70 },
71 },
72 0x38 => {
73 Name => 'ExposureTime',
74 Groups => { 2 => 'Image' },
75 Format => 'int32u',
76 ValueConv => '2**($val / 8) / 16000',
77 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
78 },
79 0x3c => { #1
80 Name => 'WB_RGGBLevels',
81 Groups => { 2 => 'Image' },
82 Format => 'int32u[4]',
83 },
84 0x58 => {
85 Name => 'FNumber',
86 Groups => { 2 => 'Image' },
87 Format => 'int32u',
88 ValueConv => '2**($val/16)',
89 PrintConv => 'sprintf("%.2g",$val)',
90 },
91 0x68 => {
92 Name => 'MaxAperture',
93 Format => 'int32u',
94 ValueConv => '2**($val/16)',
95 PrintConv => 'sprintf("%.2g",$val)',
96 },
97 0x70 => {
98 Name => 'FocalLength',
99 Format => 'int32u',
100 PrintConv => '"$val mm"',
101 },
102 0x7c => {
103 Name => 'Lens',
104 Format => 'string[32]',
105 },
106);
107
108#------------------------------------------------------------------------------
109# Extract information from Kyocera RAW image
110# Inputs: 0) ExifTool object reference, 1) dirInfo reference
111# Returns: 1 if this was a valid Kyocera RAW image
112sub ProcessRAW($$)
113{
114 my ($exifTool, $dirInfo) = @_;
115 my $raf = $$dirInfo{RAF};
116 my $size = 156; # size of header
117 my $buff;
118
119 $raf->Read($buff, $size) == $size or return 0;
120 # validate Make string ('KYOCERA' reversed)
121 substr($buff, 0x19, 7) eq 'ARECOYK' or return 0;
122 $exifTool->SetFileType();
123 SetByteOrder('MM');
124 my %dirInfo = (
125 DataPt => \$buff,
126 DataPos => 0,
127 DataLen => $size,
128 DirStart => 0,
129 DirLen => $size,
130 );
131 my $tagTablePtr = GetTagTable('Image::ExifTool::KyoceraRaw::Main');
132 $exifTool->ProcessDirectory(\%dirInfo, $tagTablePtr);
133 return 1;
134}
135
1361; # end
137
138__END__
139
140=head1 NAME
141
142Image::ExifTool::KyoceraRaw - Read Kyocera RAW meta information
143
144=head1 SYNOPSIS
145
146This module is loaded automatically by Image::ExifTool when required.
147
148=head1 DESCRIPTION
149
150This module contains definitions required by Image::ExifTool to read
151meta information from Kyocera Contax N Digital RAW images.
152
153=head1 AUTHOR
154
155Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
156
157This library is free software; you can redistribute it and/or modify it
158under the same terms as Perl itself.
159
160=head1 REFERENCES
161
162=over 4
163
164=item L<http://www.cybercom.net/~dcoffin/dcraw/>
165
166=back
167
168=head1 SEE ALSO
169
170L<Image::ExifTool::TagNames/KyoceraRaw Tags>,
171L<Image::ExifTool(3pm)|Image::ExifTool>
172
173=cut
Note: See TracBrowser for help on using the repository browser.