source: gsdl/trunk/perllib/cpan/Image/ExifTool/JPEG.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: 10.1 KB
Line 
1#------------------------------------------------------------------------------
2# File: JPEG.pm
3#
4# Description: Definitions for uncommon JPEG segments
5#
6# Revisions: 10/06/2006 - P. Harvey Created
7#------------------------------------------------------------------------------
8
9package Image::ExifTool::JPEG;
10use strict;
11use vars qw($VERSION);
12
13$VERSION = '1.07';
14
15# (this main JPEG table is for documentation purposes only)
16%Image::ExifTool::JPEG::Main = (
17 NOTES => 'This table lists information extracted by ExifTool from JPEG images.',
18 APP0 => [{
19 Name => 'JFIF',
20 Condition => '$$valPt =~ /^JFIF\0/',
21 SubDirectory => { TagTable => 'Image::ExifTool::JFIF::Main' },
22 }, {
23 Name => 'JFXX',
24 Condition => '$$valPt =~ /^JFXX\0\x10/',
25 SubDirectory => { TagTable => 'Image::ExifTool::JFIF::Extension' },
26 }, {
27 Name => 'CIFF',
28 Condition => '$$valPt =~ /^(II|MM).{4}HEAPJPGM/s',
29 SubDirectory => { TagTable => 'Image::ExifTool::CanonRaw::Main' },
30 }],
31 APP1 => [{
32 Name => 'EXIF',
33 Condition => '$$valPt =~ /^Exif\0/',
34 SubDirectory => { TagTable => 'Image::ExifTool::Exif::Main' },
35 }, {
36 Name => 'XMP',
37 Condition => '$$valPt =~ /^http/ or $$valPt =~ /<exif:/',
38 SubDirectory => { TagTable => 'Image::ExifTool::XMP::Main' },
39 }],
40 APP2 => [{
41 Name => 'ICC_Profile',
42 Condition => '$$valPt =~ /^ICC_PROFILE\0/',
43 SubDirectory => { TagTable => 'Image::ExifTool::ICC_Profile::Main' },
44 }, {
45 Name => 'FPXR',
46 Condition => '$$valPt =~ /^FPXR\0/',
47 SubDirectory => { TagTable => 'Image::ExifTool::FlashPix::Main' },
48 }],
49 APP3 => {
50 Name => 'Meta',
51 Condition => '$$valPt =~ /^(Meta|META|Exif)\0\0/',
52 SubDirectory => { TagTable => 'Image::ExifTool::Kodak::Meta' },
53 },
54 APP5 => {
55 Name => 'RMETA',
56 Condition => '$$valPt =~ /^RMETA\0/',
57 SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::RMETA' },
58 },
59 APP6 => {
60 Name => 'EPPIM',
61 Condition => '$$valPt =~ /^EPPIM\0/',
62 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::EPPIM' },
63 },
64 APP8 => {
65 Name => 'SPIFF',
66 Condition => '$$valPt =~ /^SPIFF\0/',
67 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::SPIFF' },
68 },
69 APP10 => {
70 Name => 'Comment',
71 Condition => '$$valPt =~ /^UNICODE\0/',
72 Notes => 'PhotoStudio Unicode comment',
73 },
74 APP12 => [{
75 Name => 'PictureInfo',
76 Condition => '$$valPt =~ /(\[picture info\]|Type=)/',
77 SubDirectory => { TagTable => 'Image::ExifTool::APP12::PictureInfo' },
78 }, {
79 Name => 'Ducky',
80 Condition => '$$valPt =~ /^Ducky/',
81 SubDirectory => { TagTable => 'Image::ExifTool::APP12::Ducky' },
82 }],
83 APP13 => [{
84 Name => 'Photoshop',
85 Condition => '$$valPt =~ /^(Photoshop 3.0\0|Adobe_Photoshop2.5)/',
86 SubDirectory => { TagTable => 'Image::ExifTool::Photoshop::Main' },
87 }, {
88 Name => 'Adobe_CM',
89 Condition => '$$valPt =~ /^Adobe_CM/',
90 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::AdobeCM' },
91 }],
92 APP14 => {
93 Name => 'Adobe',
94 Condition => '$$valPt =~ /^Adobe/',
95 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::Adobe' },
96 },
97 APP15 => {
98 Name => 'GraphicConverter',
99 Condition => '$$valPt =~ /^Q\s*(\d+)/',
100 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::GraphConv' },
101 },
102 COM => {
103 Name => 'Comment',
104 # note: flag as writable for documentation, but it won't show up
105 # in the TagLookup as writable because there is no WRITE_PROC
106 Writable => '1',
107 },
108 SOF => {
109 Name => 'StartOfFrame',
110 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::SOF' },
111 },
112 Trailer => [{
113 Name => 'AFCP',
114 Condition => '$$valPt =~ /AXS(!|\*).{8}$/s',
115 SubDirectory => { TagTable => 'Image::ExifTool::AFCP::Main' },
116 }, {
117 Name => 'CanonVRD',
118 Condition => '$$valPt =~ /CANON OPTIONAL DATA\0.{44}$/s',
119 SubDirectory => { TagTable => 'Image::ExifTool::CanonVRD::Main' },
120 }, {
121 Name => 'FotoStation',
122 Condition => '$$valPt =~ /\xa1\xb2\xc3\xd4$/',
123 SubDirectory => { TagTable => 'Image::ExifTool::FotoStation::Main' },
124 }, {
125 Name => 'PhotoMechanic',
126 Condition => '$$valPt =~ /cbipcbbl$/',
127 SubDirectory => { TagTable => 'Image::ExifTool::PhotoMechanic::Main' },
128 }, {
129 Name => 'MIE',
130 Condition => q{
131 $$valPt =~ /~\0\x04\0zmie~\0\0\x06.{4}[\x10\x18]\x04$/s or
132 $$valPt =~ /~\0\x04\0zmie~\0\0\x0a.{8}[\x10\x18]\x08$/s
133 },
134 SubDirectory => { TagTable => 'Image::ExifTool::MIE::Main' },
135 }, {
136 Name => 'PreviewImage',
137 Condition => '$$valPt =~ /^\xff\xd8\xff/',
138 Writable => 1, # (for docs only)
139 }],
140);
141
142# EPPIM APP6 (Toshiba PrintIM) segment (ref PH, from PDR-M700 samples)
143%Image::ExifTool::JPEG::EPPIM = (
144 GROUPS => { 0 => 'APP6', 1 => 'EPPIM', 2 => 'Image' },
145 NOTES => q{
146 APP6 is used in by the Toshiba PDR-M700 to store a TIFF structure containing
147 PrintIM information.
148 },
149 0xc4a5 => {
150 Name => 'PrintIM',
151 # must set Writable here so this tag will be saved with MakerNotes option
152 Writable => 'undef',
153 Description => 'Print Image Matching',
154 SubDirectory => {
155 TagTable => 'Image::ExifTool::PrintIM::Main',
156 },
157 },
158);
159
160# SPIFF APP8 segment. Refs:
161# 1) http://www.fileformat.info/format/spiff/
162# 2) http://www.jpeg.org/public/spiff.pdf
163%Image::ExifTool::JPEG::SPIFF = (
164 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
165 GROUPS => { 0 => 'APP8', 1 => 'SPIFF', 2 => 'Image' },
166 NOTES => q{
167 This information is found in APP8 of SPIFF-style JPEG images (the "official"
168 yet rarely used JPEG file format standard: Still Picture Interchange File
169 Format).
170 },
171 0 => {
172 Name => 'SPIFFVersion',
173 Format => 'int8u[2]',
174 PrintConv => '$val =~ tr/ /./; $val',
175 },
176 2 => {
177 Name => 'ProfileID',
178 PrintConv => {
179 0 => 'Not Specified',
180 1 => 'Continuous-tone Base',
181 2 => 'Continuous-tone Progressive',
182 3 => 'Bi-level Facsimile',
183 4 => 'Continuous-tone Facsimile',
184 },
185 },
186 3 => 'ColorComponents',
187 6 => {
188 Name => 'ImageHeight',
189 Notes => q{
190 at index 4 in specification, but there are 2 extra bytes here in my only
191 SPIFF sample, version 1.2
192 },
193 Format => 'int32u',
194 },
195 10 => {
196 Name => 'ImageWidth',
197 Format => 'int32u',
198 },
199 14 => {
200 Name => 'ColorSpace',
201 PrintConv => {
202 0 => 'Bi-level',
203 1 => 'YCbCr, ITU-R BT 709, video',
204 2 => 'No color space specified',
205 3 => 'YCbCr, ITU-R BT 601-1, RGB',
206 4 => 'YCbCr, ITU-R BT 601-1, video',
207 8 => 'Gray-scale',
208 9 => 'PhotoYCC',
209 10 => 'RGB',
210 11 => 'CMY',
211 12 => 'CMYK',
212 13 => 'YCCK',
213 14 => 'CIELab',
214 },
215 },
216 15 => 'BitsPerSample',
217 16 => {
218 Name => 'Compression',
219 PrintConv => {
220 0 => 'Uncompressed, interleaved, 8 bits per sample',
221 1 => 'Modified Huffman',
222 2 => 'Modified READ',
223 3 => 'Modified Modified READ',
224 4 => 'JBIG',
225 5 => 'JPEG',
226 },
227 },
228 17 => {
229 Name => 'ResolutionUnit',
230 PrintConv => {
231 0 => 'None',
232 1 => 'inches',
233 2 => 'cm',
234 },
235 },
236 18 => {
237 Name => 'YResolution',
238 Format => 'int32u',
239 },
240 22 => {
241 Name => 'XResolution',
242 Format => 'int32u',
243 },
244);
245
246# AdobeCM APP13 (no references)
247%Image::ExifTool::JPEG::AdobeCM = (
248 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
249 GROUPS => { 0 => 'APP13', 1 => 'AdobeCM', 2 => 'Image' },
250 NOTES => q{
251 The "Adobe_CM" APP13 segment presumably contains color management
252 information, but the meaning of the data is currently unknown. If anyone
253 has an idea about what this means, please let me know.
254 },
255 FORMAT => 'int16u',
256 0 => 'AdobeCMType',
257);
258
259# Adobe APP14 refs:
260# http://partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf
261# http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
262%Image::ExifTool::JPEG::Adobe = (
263 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
264 GROUPS => { 0 => 'APP14', 1 => 'Adobe', 2 => 'Image' },
265 NOTES => 'The "Adobe" APP14 segment stores image encoding information for DCT filters.',
266 FORMAT => 'int16u',
267 0 => 'DCTEncodeVersion',
268 1 => {
269 Name => 'APP14Flags0',
270 PrintConv => { BITMASK => {
271 15 => 'Encoded with Blend=1 downsampling'
272 } },
273 },
274 2 => {
275 Name => 'APP14Flags1',
276 PrintConv => { BITMASK => { } },
277 },
278 3 => {
279 Name => 'ColorTransform',
280 Format => 'int8u',
281 PrintConv => {
282 0 => 'Unknown (RGB or CMYK)',
283 1 => 'YCbCr',
284 2 => 'YCCK',
285 },
286 },
287);
288
289# GraphicConverter APP15 (ref PH)
290%Image::ExifTool::JPEG::GraphConv = (
291 GROUPS => { 0 => 'APP15', 1 => 'GraphConv', 2 => 'Image' },
292 NOTES => 'APP15 is used by GraphicConverter to store JPEG quality.',
293 'Q' => 'Quality',
294);
295
2961; # end
297
298__END__
299
300=head1 NAME
301
302Image::ExifTool::JPEG - Definitions for uncommon JPEG segments
303
304=head1 SYNOPSIS
305
306This module is used by Image::ExifTool
307
308=head1 DESCRIPTION
309
310This module contains definitions required by Image::ExifTool for some
311uncommon JPEG segments. For speed reasons, definitions for more common JPEG
312segments are included in the Image::ExifTool module itself.
313
314=head1 AUTHOR
315
316Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
317
318This library is free software; you can redistribute it and/or modify it
319under the same terms as Perl itself.
320
321=head1 SEE ALSO
322
323L<Image::ExifTool::TagNames/JPEG Tags>,
324L<Image::ExifTool(3pm)|Image::ExifTool>
325
326=cut
327
Note: See TracBrowser for help on using the repository browser.