source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/JPEG.pm@ 34921

Last change on this file since 34921 was 34921, checked in by anupama, 3 years ago

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File size: 22.0 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);
12use Image::ExifTool qw(:DataAccess :Utils);
13
14$VERSION = '1.30';
15
16sub ProcessOcad($$$);
17sub ProcessJPEG_HDR($$$);
18
19# (most of the tags in this table are for documentation purposes only)
20%Image::ExifTool::JPEG::Main = (
21 NOTES => q{
22 This table lists information extracted by ExifTool from JPEG images. See
23 L<https://www.w3.org/Graphics/JPEG/jfif3.pdf> for the JPEG specification.
24 },
25 APP0 => [{
26 Name => 'JFIF',
27 Condition => '$$valPt =~ /^JFIF\0/',
28 SubDirectory => { TagTable => 'Image::ExifTool::JFIF::Main' },
29 }, {
30 Name => 'JFXX',
31 Condition => '$$valPt =~ /^JFXX\0\x10/',
32 SubDirectory => { TagTable => 'Image::ExifTool::JFIF::Extension' },
33 }, {
34 Name => 'CIFF',
35 Condition => '$$valPt =~ /^(II|MM).{4}HEAPJPGM/s',
36 SubDirectory => { TagTable => 'Image::ExifTool::CanonRaw::Main' },
37 }, {
38 Name => 'AVI1',
39 Condition => '$$valPt =~ /^AVI1/',
40 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::AVI1' },
41 }, {
42 Name => 'Ocad',
43 Condition => '$$valPt =~ /^Ocad/',
44 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::Ocad' },
45 }],
46 APP1 => [{
47 Name => 'EXIF',
48 Condition => '$$valPt =~ /^Exif\0/',
49 SubDirectory => { TagTable => 'Image::ExifTool::Exif::Main' },
50 }, {
51 Name => 'ExtendedXMP',
52 Condition => '$$valPt =~ m{^http://ns.adobe.com/xmp/extension/\0}',
53 SubDirectory => { TagTable => 'Image::ExifTool::XMP::Main' },
54 }, {
55 Name => 'XMP',
56 Condition => '$$valPt =~ /^http/ or $$valPt =~ /<exif:/',
57 SubDirectory => { TagTable => 'Image::ExifTool::XMP::Main' },
58 }, {
59 Name => 'QVCI',
60 Condition => '$$valPt =~ /^QVCI\0/',
61 SubDirectory => { TagTable => 'Image::ExifTool::Casio::QVCI' },
62 }, {
63 Name => 'FLIR',
64 Condition => '$$valPt =~ /^FLIR\0/',
65 SubDirectory => { TagTable => 'Image::ExifTool::FLIR::FFF' },
66 }, {
67 Name => 'RawThermalImage', # (from Parrot Bebop-Pro Thermal drone)
68 Condition => '$$valPt =~ /^PARROT\0(II\x2a\0|MM\0\x2a)/',
69 Groups => { 0 => 'APP1', 1 => 'Parrot', 2 => 'Preview' },
70 Notes => 'thermal image from Parrot Bebop-Pro Thermal drone',
71 RawConv => 'substr($val, 7)',
72 Binary => 1,
73 }],
74 APP2 => [{
75 Name => 'ICC_Profile',
76 Condition => '$$valPt =~ /^ICC_PROFILE\0/',
77 SubDirectory => { TagTable => 'Image::ExifTool::ICC_Profile::Main' },
78 }, {
79 Name => 'FPXR',
80 Condition => '$$valPt =~ /^FPXR\0/',
81 SubDirectory => { TagTable => 'Image::ExifTool::FlashPix::Main' },
82 }, {
83 Name => 'MPF',
84 Condition => '$$valPt =~ /^MPF\0/',
85 SubDirectory => { TagTable => 'Image::ExifTool::MPF::Main' },
86 }, {
87 Name => 'PreviewImage',
88 Condition => '$$valPt =~ /^(|QVGA\0|BGTH)\xff\xd8\xff\xdb/',
89 Notes => 'Samsung APP2 preview image', # (Samsung/GoPro="", BenQ="QVGA\0", Digilife="BGTH")
90 }],
91 APP3 => [{
92 Name => 'Meta',
93 Condition => '$$valPt =~ /^(Meta|META|Exif)\0\0/',
94 SubDirectory => { TagTable => 'Image::ExifTool::Kodak::Meta' },
95 }, {
96 Name => 'Stim',
97 Condition => '$$valPt =~ /^Stim\0/',
98 SubDirectory => { TagTable => 'Image::ExifTool::Stim::Main' },
99 }, {
100 Name => 'ThermalData', # (written by DJI FLIR models)
101 Condition => '$$self{Make} eq "DJI"',
102 Notes => 'DJI raw thermal data',
103 Groups => { 0 => 'APP3', 1 => 'DJI', 2 => 'Image' },
104 Binary => 1,
105 }, {
106 Name => 'PreviewImage', # (written by HP R837 and Samsung S1060)
107 Condition => '$$valPt =~ /^\xff\xd8\xff\xdb/',
108 Notes => 'Samsung/HP preview image', # (Samsung, HP, BenQ)
109 }],
110 APP4 => [{
111 Name => 'Scalado',
112 Condition => '$$valPt =~ /^SCALADO\0/',
113 SubDirectory => { TagTable => 'Image::ExifTool::Scalado::Main' },
114 }, {
115 Name => 'FPXR', # (non-standard location written by some HP models)
116 Condition => '$$valPt =~ /^FPXR\0/',
117 SubDirectory => { TagTable => 'Image::ExifTool::FlashPix::Main' },
118 }, {
119 Name => 'ThermalParams', # (written by DJI FLIR models)
120 Condition => '$$self{Make} eq "DJI" and $$valPt =~ /^\xaa\x55\x12\x06/',
121 SubDirectory => { TagTable => 'Image::ExifTool::DJI::ThermalParams' },
122 }, {
123 Name => 'PreviewImage', # (eg. Samsung S1060)
124 Notes => 'continued from APP3',
125 }],
126 APP5 => [{
127 Name => 'RMETA',
128 Condition => '$$valPt =~ /^RMETA\0/',
129 SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::RMETA' },
130 }, {
131 Name => 'SamsungUniqueID',
132 Condition => '$$valPt =~ /ssuniqueid\0/',
133 SubDirectory => { TagTable => 'Image::ExifTool::Samsung::APP5' },
134 }, {
135 Name => 'ThermalCalibration', # (written by DJI FLIR models)
136 Condition => '$$self{Make} eq "DJI"',
137 Notes => 'DJI thermal calibration data',
138 Groups => { 0 => 'APP5', 1 => 'DJI', 2 => 'Image' },
139 Binary => 1,
140 }, {
141 Name => 'PreviewImage', # (eg. BenQ DC E1050)
142 Notes => 'continued from APP4',
143 }],
144 APP6 => [{
145 Name => 'EPPIM',
146 Condition => '$$valPt =~ /^EPPIM\0/',
147 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::EPPIM' },
148 }, {
149 Name => 'NITF',
150 Condition => '$$valPt =~ /^NTIF\0/',
151 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::NITF' },
152 }, {
153 Name => 'HP_TDHD', # (written by R837)
154 Condition => '$$valPt =~ /^TDHD\x01\0\0\0/',
155 SubDirectory => { TagTable => 'Image::ExifTool::HP::TDHD' },
156 }, {
157 Name => 'GoPro',
158 Condition => '$$valPt =~ /^GoPro\0/',
159 SubDirectory => { TagTable => 'Image::ExifTool::GoPro::GPMF' },
160 # also seen Motorola APP6 "MMIMETA\0", with sub-types: AL3A,ALED,MMI0,MOTD,QC3A
161 }, {
162 Name => 'DJI_DTAT', # (written by ZH20T)
163 Condition => '$$valPt =~ /^DTAT\0\0.\{/s',
164 Groups => { 0 => 'APP6', 1 => 'DJI' },
165 Notes => 'DJI Thermal Analysis Tool record',
166 ValueConv => 'substr($val,7)',
167 }],
168 APP7 => [{
169 Name => 'Pentax',
170 Condition => '$$valPt =~ /^PENTAX \0/',
171 SubDirectory => { TagTable => 'Image::ExifTool::Pentax::Main' },
172 }, {
173 Name => 'Huawei',
174 Condition => '$$valPt =~ /^HUAWEI\0\0/',
175 SubDirectory => { TagTable => 'Image::ExifTool::Unknown::Main' },
176 }, {
177 Name => 'Qualcomm',
178 Condition => '$$valPt =~ /^\x1aQualcomm Camera Attributes/',
179 SubDirectory => { TagTable => 'Image::ExifTool::Qualcomm::Main' },
180 }],
181 APP8 => {
182 Name => 'SPIFF',
183 Condition => '$$valPt =~ /^SPIFF\0/',
184 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::SPIFF' },
185 },
186 APP9 => {
187 Name => 'MediaJukebox',
188 Condition => '$$valPt =~ /^Media Jukebox\0/',
189 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::MediaJukebox' },
190 },
191 APP10 => {
192 Name => 'Comment',
193 Condition => '$$valPt =~ /^UNICODE\0/',
194 Notes => 'PhotoStudio Unicode comment',
195 },
196 APP11 => {
197 Name => 'JPEG-HDR',
198 Condition => '$$valPt =~ /^HDR_RI /',
199 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::HDR' },
200 },
201 APP12 => [{
202 Name => 'PictureInfo',
203 Condition => '$$valPt =~ /(\[picture info\]|Type=)/',
204 SubDirectory => { TagTable => 'Image::ExifTool::APP12::PictureInfo' },
205 }, {
206 Name => 'Ducky',
207 Condition => '$$valPt =~ /^Ducky/',
208 SubDirectory => { TagTable => 'Image::ExifTool::APP12::Ducky' },
209 }],
210 APP13 => [{
211 Name => 'Photoshop',
212 Condition => '$$valPt =~ /^(Photoshop 3.0\0|Adobe_Photoshop2.5)/',
213 SubDirectory => { TagTable => 'Image::ExifTool::Photoshop::Main' },
214 }, {
215 Name => 'Adobe_CM',
216 Condition => '$$valPt =~ /^Adobe_CM/',
217 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::AdobeCM' },
218 }],
219 APP14 => {
220 Name => 'Adobe',
221 Condition => '$$valPt =~ /^Adobe/',
222 Writable => 2, # (for docs only)
223 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::Adobe' },
224 },
225 APP15 => {
226 Name => 'GraphicConverter',
227 Condition => '$$valPt =~ /^Q\s*(\d+)/',
228 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::GraphConv' },
229 },
230 # APP15 - Also unknown "TEXT\0" segment stored by Casio/FujiFilm
231 COM => {
232 Name => 'Comment',
233 # note: flag as writable for documentation, but it won't show up
234 # in the TagLookup as writable because there is no WRITE_PROC
235 Writable => 2,
236 },
237 SOF => {
238 Name => 'StartOfFrame',
239 SubDirectory => { TagTable => 'Image::ExifTool::JPEG::SOF' },
240 },
241 DQT => {
242 Name => 'DefineQuantizationTable',
243 Notes => 'used to calculate the Extra JPEGDigest tag value',
244 },
245 Trailer => [{
246 Name => 'AFCP',
247 Condition => '$$valPt =~ /AXS(!|\*).{8}$/s',
248 SubDirectory => { TagTable => 'Image::ExifTool::AFCP::Main' },
249 }, {
250 Name => 'CanonVRD',
251 Condition => '$$valPt =~ /CANON OPTIONAL DATA\0.{44}$/s',
252 SubDirectory => { TagTable => 'Image::ExifTool::CanonVRD::Main' },
253 }, {
254 Name => 'FotoStation',
255 Condition => '$$valPt =~ /\xa1\xb2\xc3\xd4$/',
256 SubDirectory => { TagTable => 'Image::ExifTool::FotoStation::Main' },
257 }, {
258 Name => 'PhotoMechanic',
259 Condition => '$$valPt =~ /cbipcbbl$/',
260 SubDirectory => { TagTable => 'Image::ExifTool::PhotoMechanic::Main' },
261 }, {
262 Name => 'MIE',
263 Condition => q{
264 $$valPt =~ /~\0\x04\0zmie~\0\0\x06.{4}[\x10\x18]\x04$/s or
265 $$valPt =~ /~\0\x04\0zmie~\0\0\x0a.{8}[\x10\x18]\x08$/s
266 },
267 SubDirectory => { TagTable => 'Image::ExifTool::MIE::Main' },
268 }, {
269 Name => 'Samsung',
270 Condition => '$$valPt =~ /QDIOBS$/',
271 SubDirectory => { TagTable => 'Image::ExifTool::Samsung::Trailer' },
272 }, {
273 Name => 'EmbeddedVideo',
274 Notes => 'extracted only when ExtractEmbedded option is used',
275 Condition => '$$valPt =~ /^.{4}ftyp/s',
276 }, {
277 Name => 'Insta360',
278 Condition => '$$valPt =~ /8db42d694ccc418790edff439fe026bf$/',
279 }, {
280 Name => 'PreviewImage',
281 Condition => '$$valPt =~ /^\xff\xd8\xff/',
282 Writable => 2, # (for docs only)
283 }],
284);
285
286# EPPIM APP6 (Toshiba PrintIM) segment (ref PH, from PDR-M700 samples)
287%Image::ExifTool::JPEG::EPPIM = (
288 GROUPS => { 0 => 'APP6', 1 => 'EPPIM', 2 => 'Image' },
289 NOTES => q{
290 APP6 is used in by the Toshiba PDR-M700 to store a TIFF structure containing
291 PrintIM information.
292 },
293 0xc4a5 => {
294 Name => 'PrintIM',
295 # must set Writable here so this tag will be saved with MakerNotes option
296 # (but it isn't actually writable because there is no WRITE_PROC)
297 Writable => 'undef',
298 Description => 'Print Image Matching',
299 SubDirectory => {
300 TagTable => 'Image::ExifTool::PrintIM::Main',
301 },
302 },
303);
304
305# APP8 SPIFF segment. Refs:
306# 1) http://www.fileformat.info/format/spiff/
307# 2) http://www.jpeg.org/public/spiff.pdf
308%Image::ExifTool::JPEG::SPIFF = (
309 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
310 GROUPS => { 0 => 'APP8', 1 => 'SPIFF', 2 => 'Image' },
311 NOTES => q{
312 This information is found in APP8 of SPIFF-style JPEG images (the "official"
313 yet rarely used JPEG file format standard: Still Picture Interchange File
314 Format). See L<http://www.jpeg.org/public/spiff.pdf> for the official
315 specification.
316 },
317 0 => {
318 Name => 'SPIFFVersion',
319 Format => 'int8u[2]',
320 PrintConv => '$val =~ tr/ /./; $val',
321 },
322 2 => {
323 Name => 'ProfileID',
324 PrintConv => {
325 0 => 'Not Specified',
326 1 => 'Continuous-tone Base',
327 2 => 'Continuous-tone Progressive',
328 3 => 'Bi-level Facsimile',
329 4 => 'Continuous-tone Facsimile',
330 },
331 },
332 3 => 'ColorComponents',
333 6 => {
334 Name => 'ImageHeight',
335 Notes => q{
336 at index 4 in specification, but there are 2 extra bytes here in my only
337 SPIFF sample, version 1.2
338 },
339 Format => 'int32u',
340 },
341 10 => {
342 Name => 'ImageWidth',
343 Format => 'int32u',
344 },
345 14 => {
346 Name => 'ColorSpace',
347 PrintConv => {
348 0 => 'Bi-level',
349 1 => 'YCbCr, ITU-R BT 709, video',
350 2 => 'No color space specified',
351 3 => 'YCbCr, ITU-R BT 601-1, RGB',
352 4 => 'YCbCr, ITU-R BT 601-1, video',
353 8 => 'Gray-scale',
354 9 => 'PhotoYCC',
355 10 => 'RGB',
356 11 => 'CMY',
357 12 => 'CMYK',
358 13 => 'YCCK',
359 14 => 'CIELab',
360 },
361 },
362 15 => 'BitsPerSample',
363 16 => {
364 Name => 'Compression',
365 PrintConv => {
366 0 => 'Uncompressed, interleaved, 8 bits per sample',
367 1 => 'Modified Huffman',
368 2 => 'Modified READ',
369 3 => 'Modified Modified READ',
370 4 => 'JBIG',
371 5 => 'JPEG',
372 },
373 },
374 17 => {
375 Name => 'ResolutionUnit',
376 PrintConv => {
377 0 => 'None',
378 1 => 'inches',
379 2 => 'cm',
380 },
381 },
382 18 => {
383 Name => 'YResolution',
384 Format => 'int32u',
385 },
386 22 => {
387 Name => 'XResolution',
388 Format => 'int32u',
389 },
390);
391
392# APP9 Media Jukebox segment (ref PH)
393%Image::ExifTool::JPEG::MediaJukebox = (
394 GROUPS => { 0 => 'XML', 1 => 'MediaJukebox', 2 => 'Image' },
395 VARS => { NO_ID => 1 },
396 NOTES => 'Tags found in the XML metadata of the APP9 "Media Jukebox" segment.',
397 Date => {
398 Groups => { 2 => 'Time' },
399 # convert from days since Dec 30, 1899 to seconds since Jan 1, 1970
400 ValueConv => 'ConvertUnixTime(($val - (70 * 365 + 17 + 2)) * 24 * 3600)',
401 PrintConv => '$self->ConvertDateTime($val)',
402 },
403 Album => { },
404 Caption => { },
405 Keywords => { },
406 Name => { },
407 People => { },
408 Places => { },
409 Tool_Name => { },
410 Tool_Version => { },
411);
412
413# JPEG-HDR APP11 information (ref PH, guessed from http://anyhere.com/gward/papers/cic05.pdf)
414%Image::ExifTool::JPEG::HDR = (
415 GROUPS => { 0 => 'APP11', 1 => 'JPEG-HDR', 2 => 'Image' },
416 PROCESS_PROC => \&ProcessJPEG_HDR,
417 TAG_PREFIX => '', # (no prefix for unknown tags)
418 NOTES => 'Information extracted from APP11 of a JPEG-HDR image.',
419 ver => 'JPEG-HDRVersion',
420 # (need names for the next 3 tags)
421 ln0 => { Description => 'Ln0' },
422 ln1 => { Description => 'Ln1' },
423 s2n => { Description => 'S2n' },
424 alp => { Name => 'Alpha' }, # (Alpha/Beta are saturation parameters)
425 bet => { Name => 'Beta' },
426 cor => { Name => 'CorrectionMethod' },
427 RatioImage => {
428 Groups => { 2 => 'Preview' },
429 Notes => 'the embedded JPEG-compressed ratio image',
430 Binary => 1,
431 },
432);
433
434# AdobeCM APP13 (no references)
435%Image::ExifTool::JPEG::AdobeCM = (
436 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
437 GROUPS => { 0 => 'APP13', 1 => 'AdobeCM', 2 => 'Image' },
438 NOTES => q{
439 The APP13 "Adobe_CM" segment presumably contains color management
440 information, but the meaning of the data is currently unknown. If anyone
441 has an idea about what this means, please let me know.
442 },
443 FORMAT => 'int16u',
444 0 => 'AdobeCMType',
445);
446
447# Adobe APP14 refs:
448# http://partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf
449# http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
450%Image::ExifTool::JPEG::Adobe = (
451 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
452 GROUPS => { 0 => 'APP14', 1 => 'Adobe', 2 => 'Image' },
453 NOTES => q{
454 The APP14 "Adobe" segment stores image encoding information for DCT filters.
455 This segment may be copied or deleted as a block using the Extra "Adobe"
456 tag, but note that it is not deleted by default when deleting all metadata
457 because it may affect the appearance of the image.
458 },
459 FORMAT => 'int16u',
460 0 => 'DCTEncodeVersion',
461 1 => {
462 Name => 'APP14Flags0',
463 PrintConv => {
464 0 => '(none)',
465 BITMASK => {
466 15 => 'Encoded with Blend=1 downsampling'
467 },
468 },
469 },
470 2 => {
471 Name => 'APP14Flags1',
472 PrintConv => {
473 0 => '(none)',
474 BITMASK => { },
475 },
476 },
477 3 => {
478 Name => 'ColorTransform',
479 Format => 'int8u',
480 PrintConv => {
481 0 => 'Unknown (RGB or CMYK)',
482 1 => 'YCbCr',
483 2 => 'YCCK',
484 },
485 },
486);
487
488# GraphicConverter APP15 (ref PH)
489%Image::ExifTool::JPEG::GraphConv = (
490 GROUPS => { 0 => 'APP15', 1 => 'GraphConv', 2 => 'Image' },
491 NOTES => 'APP15 is used by GraphicConverter to store JPEG quality.',
492 'Q' => 'Quality',
493);
494
495# APP0 AVI1 segment (ref http://www.schnarff.com/file-formats/bmp/BMPDIB.TXT)
496%Image::ExifTool::JPEG::AVI1 = (
497 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
498 GROUPS => { 0 => 'APP0', 1 => 'AVI1', 2 => 'Image' },
499 NOTES => 'This information may be found in APP0 of JPEG image data from AVI videos.',
500 FIRST_ENTRY => 0,
501 0 => {
502 Name => 'InterleavedField',
503 PrintConv => {
504 0 => 'Not Interleaved',
505 1 => 'Odd',
506 2 => 'Even',
507 },
508 },
509);
510
511# APP0 Ocad segment (ref PH)
512%Image::ExifTool::JPEG::Ocad = (
513 PROCESS_PROC => \&ProcessOcad,
514 GROUPS => { 0 => 'APP0', 1 => 'Ocad', 2 => 'Image' },
515 TAG_PREFIX => 'Ocad',
516 FIRST_ENTRY => 0,
517 NOTES => q{
518 Tags extracted from the JPEG APP0 "Ocad" segment (found in Photobucket
519 images).
520 },
521 Rev => {
522 Name => 'OcadRevision',
523 Format => 'string[6]',
524 }
525);
526
527# APP6 NITF segment (National Imagery Transmission Format)
528# ref http://www.gwg.nga.mil/ntb/baseline/docs/n010697/bwcguide25aug98.pdf
529%Image::ExifTool::JPEG::NITF = (
530 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
531 GROUPS => { 0 => 'APP6', 1 => 'NITF', 2 => 'Image' },
532 NOTES => q{
533 Information in APP6 used by the National Imagery Transmission Format. See
534 L<http://www.gwg.nga.mil/ntb/baseline/docs/n010697/bwcguide25aug98.pdf> for
535 the official specification.
536 },
537 0 => {
538 Name => 'NITFVersion',
539 Format => 'int8u[2]',
540 ValueConv => 'sprintf("%d.%.2d", split(" ",$val))',
541 },
542 2 => {
543 Name => 'ImageFormat',
544 ValueConv => 'chr($val)',
545 PrintConv => { B => 'IMode B' },
546 },
547 3 => {
548 Name => 'BlocksPerRow',
549 Format => 'int16u',
550 },
551 5 => {
552 Name => 'BlocksPerColumn',
553 Format => 'int16u',
554 },
555 7 => {
556 Name => 'ImageColor',
557 PrintConv => { 0 => 'Monochrome' },
558 },
559 8 => 'BitDepth',
560 9 => {
561 Name => 'ImageClass',
562 PrintConv => {
563 0 => 'General Purpose',
564 4 => 'Tactical Imagery',
565 },
566 },
567 10 => {
568 Name => 'JPEGProcess',
569 PrintConv => {
570 1 => 'Baseline sequential DCT, Huffman coding, 8-bit samples',
571 4 => 'Extended sequential DCT, Huffman coding, 12-bit samples',
572 },
573 },
574 11 => 'Quality',
575 12 => {
576 Name => 'StreamColor',
577 PrintConv => { 0 => 'Monochrome' },
578 },
579 13 => 'StreamBitDepth',
580 14 => {
581 Name => 'Flags',
582 Format => 'int32u',
583 PrintConv => 'sprintf("0x%x", $val)',
584 },
585);
586
587#------------------------------------------------------------------------------
588# Extract information from the JPEG APP0 Ocad segment
589# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
590# Returns: 1 on success
591sub ProcessOcad($$$)
592{
593 my ($et, $dirInfo, $tagTablePtr) = @_;
594 my $dataPt = $$dirInfo{DataPt};
595 $et->VerboseDir('APP0 Ocad', undef, length $$dataPt);
596 for (;;) {
597 last unless $$dataPt =~ /\$(\w+):([^\0\$]+)/g;
598 my ($tag, $val) = ($1, $2);
599 $val =~ s/^\s+//; $val =~ s/\s+$//; # remove leading/trailing spaces
600 AddTagToTable($tagTablePtr, $tag) unless $$tagTablePtr{$tag};
601 $et->HandleTag($tagTablePtr, $tag, $val);
602 }
603 return 1;
604}
605
606#------------------------------------------------------------------------------
607# Extract information from the JPEG APP0 Ocad segment
608# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
609# Returns: 1 on success
610sub ProcessJPEG_HDR($$$)
611{
612 my ($et, $dirInfo, $tagTablePtr) = @_;
613 my $dataPt = $$dirInfo{DataPt};
614 $$dataPt =~ /~\0/g or $et->Warn('Unrecognized JPEG-HDR format'), return 0;
615 my $pos = pos $$dataPt;
616 my $meta = substr($$dataPt, 7, $pos-9);
617 $et->VerboseDir('APP11 JPEG-HDR', undef, length $$dataPt);
618 while ($meta =~ /(\w+)=([^,\s]*)/g) {
619 my ($tag, $val) = ($1, $2);
620 AddTagToTable($tagTablePtr, $tag) unless $$tagTablePtr{$tag};
621 $et->HandleTag($tagTablePtr, $tag, $val);
622 }
623 $et->HandleTag($tagTablePtr, 'RatioImage', substr($$dataPt, $pos));
624 return 1;
625}
626
6271; # end
628
629__END__
630
631=head1 NAME
632
633Image::ExifTool::JPEG - Definitions for uncommon JPEG segments
634
635=head1 SYNOPSIS
636
637This module is used by Image::ExifTool
638
639=head1 DESCRIPTION
640
641This module contains definitions required by Image::ExifTool for some
642uncommon JPEG segments. For speed reasons, definitions for more common JPEG
643segments are included in the Image::ExifTool module itself.
644
645=head1 AUTHOR
646
647Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
648
649This library is free software; you can redistribute it and/or modify it
650under the same terms as Perl itself.
651
652=head1 SEE ALSO
653
654L<Image::ExifTool::TagNames/JPEG Tags>,
655L<Image::ExifTool(3pm)|Image::ExifTool>
656
657=cut
658
Note: See TracBrowser for help on using the repository browser.