source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/MNG.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: 16.2 KB
Line 
1#------------------------------------------------------------------------------
2# File: MNG.pm
3#
4# Description: MNG and JNG meta information tags
5#
6# Revisions: 06/23/2005 - P. Harvey Created
7#
8# References: 1) http://www.libpng.org/pub/mng/
9#------------------------------------------------------------------------------
10
11package Image::ExifTool::MNG;
12
13use strict;
14use vars qw($VERSION);
15use Image::ExifTool qw(:DataAccess :Utils);
16
17$VERSION = '1.00';
18
19# MNG chunks
20%Image::ExifTool::MNG::Main = (
21 GROUPS => { 2 => 'Image' },
22 NOTES => q{
23 This table contains definitions for tags found in MNG and JNG images. MNG
24 is a superset of PNG and JNG, so a MNG image may contain any of these tags
25 as well as any PNG tags. Conversely, only some of these tags are valid for
26 JNG images.
27 },
28 BACK => {
29 Name => 'Background',
30 SubDirectory => { TagTable => 'Image::ExifTool::MNG::Background' },
31 },
32 BASI => {
33 Name => 'BasisObject',
34 SubDirectory => { TagTable => 'Image::ExifTool::MNG::BasisObject' },
35 },
36 CLIP => {
37 Name => 'ClipObjects',
38 SubDirectory => { TagTable => 'Image::ExifTool::MNG::ClipObjects' },
39 },
40 CLON => {
41 Name => 'CloneObject',
42 SubDirectory => { TagTable => 'Image::ExifTool::MNG::CloneObject' },
43 },
44 DBYK => {
45 Name => 'DropByKeyword',
46 Binary => 1,
47 },
48 DEFI => {
49 Name => 'DefineObject',
50 SubDirectory => { TagTable => 'Image::ExifTool::MNG::DefineObject' },
51 },
52 DHDR => {
53 Name => 'DeltaPNGHeader',
54 SubDirectory => { TagTable => 'Image::ExifTool::MNG::DeltaPNGHeader' },
55 },
56 DISC => {
57 Name => 'DiscardObjects',
58 ValueConv => 'join(" ",unpack("n*",$val))',
59 },
60 DROP => {
61 Name => 'DropChunks',
62 ValueConv => 'join(" ",$val=~/..../g)',
63 },
64# ENDL
65 eXPi => {
66 Name => 'ExportImage',
67 SubDirectory => { TagTable => 'Image::ExifTool::MNG::ExportImage' },
68 },
69 fPRI => {
70 Name => 'FramePriority',
71 SubDirectory => { TagTable => 'Image::ExifTool::MNG::FramePriority' },
72 },
73 FRAM => {
74 Name => 'Frame',
75 Binary => 1,
76 },
77# IJNG
78# IPNG
79# JDAA (JNG)
80# JDAT (JNG)
81 JHDR => { # (JNG)
82 Name => 'JNGHeader',
83 SubDirectory => { TagTable => 'Image::ExifTool::MNG::JNGHeader' },
84 },
85# JSEP (JNG)
86 LOOP => {
87 Name => 'Loop',
88 SubDirectory => { TagTable => 'Image::ExifTool::MNG::Loop' },
89 },
90 MAGN => {
91 Name => 'MagnifyObject',
92 SubDirectory => { TagTable => 'Image::ExifTool::MNG::MagnifyObject' },
93 },
94# MEND
95 MHDR => {
96 Name => 'MNGHeader',
97 SubDirectory => { TagTable => 'Image::ExifTool::MNG::MNGHeader' },
98 },
99 MOVE => {
100 Name => 'MoveObjects',
101 SubDirectory => { TagTable => 'Image::ExifTool::MNG::MoveObjects' },
102 },
103 nEED => {
104 Name => 'ResourcesNeeded',
105 Binary => 1,
106 },
107 ORDR => {
108 Name => 'OrderingRestrictions',
109 Binary => 1,
110 },
111 PAST => {
112 Name => 'PasteImage',
113 SubDirectory => { TagTable => 'Image::ExifTool::MNG::PasteImage' },
114 },
115 pHYg => {
116 Name => 'GlobalPixelSize',
117 SubDirectory => { TagTable => 'Image::ExifTool::PNG::PhysicalPixel' },
118 },
119 PPLT => {
120 Name => 'PartialPalette',
121 Binary => 1,
122 },
123 PROM => {
124 Name => 'PromoteParent',
125 SubDirectory => { TagTable => 'Image::ExifTool::MNG::PromoteParent' },
126 },
127 SAVE => {
128 Name => 'SaveObjects',
129 Binary => 1,
130 },
131 SEEK => {
132 Name => 'SeekPoint',
133 ValueConv => '$val=~s/\0.*//s; $val',
134 },
135 SHOW => {
136 Name => 'ShowObjects',
137 SubDirectory => { TagTable => 'Image::ExifTool::MNG::ShowObjects' },
138 },
139 TERM => {
140 Name => 'TerminationAction',
141 SubDirectory => { TagTable => 'Image::ExifTool::MNG::TerminationAction' },
142 },
143);
144
145# MNG MHDR chunk
146%Image::ExifTool::MNG::MNGHeader = (
147 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
148 GROUPS => { 2 => 'Image' },
149 FORMAT => 'int32u',
150 0 => 'ImageWidth',
151 1 => 'ImageHeight',
152 2 => 'TicksPerSecond',
153 3 => 'NominalLayerCount',
154 4 => 'NominalFrameCount',
155 5 => 'NominalPlayTime',
156 6 => {
157 Name => 'SimplicityProfile',
158 PrintConv => 'sprintf("0x%.8x", $val)',
159 },
160);
161
162# MNG BASI chunk
163%Image::ExifTool::MNG::BasisObject = (
164 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
165 GROUPS => { 2 => 'Image' },
166 0 => {
167 Name => 'ImageWidth',
168 Format => 'int32u',
169 },
170 4 => {
171 Name => 'ImageHeight',
172 Format => 'int32u',
173 },
174 8 => 'BitDepth',
175 9 => {
176 Name => 'ColorType',
177 RawConv => '$Image::ExifTool::PNG::colorType = $val',
178 PrintConv => {
179 0 => 'Grayscale',
180 2 => 'RGB',
181 3 => 'Palette',
182 4 => 'Grayscale with Alpha',
183 6 => 'RGB with Alpha',
184 },
185 },
186 10 => {
187 Name => 'Compression',
188 PrintConv => { 0 => 'Deflate/Inflate' },
189 },
190 11 => {
191 Name => 'Filter',
192 PrintConv => { 0 => 'Adaptive' },
193 },
194 12 => {
195 Name => 'Interlace',
196 PrintConv => { 0 => 'Noninterlaced', 1 => 'Adam7 Interlace' },
197 },
198 13 => {
199 Name => 'RedSample',
200 Format => 'int32u',
201 },
202 17 => {
203 Name => 'GreenSample',
204 Format => 'int32u',
205 },
206 21 => {
207 Name => 'BlueSample',
208 Format => 'int32u',
209 },
210 25 => {
211 Name => 'AlphaSample',
212 Format => 'int32u',
213 },
214 26 => 'Viewable',
215);
216
217# MNG LOOP chunk
218%Image::ExifTool::MNG::Loop = (
219 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
220 GROUPS => { 2 => 'Image' },
221 0 => 'NestLevel',
222 1 => {
223 Name => 'IterationCount',
224 Format => 'int32u',
225 },
226 5 => {
227 Name => 'TerminationCondition',
228 PrintConv => {
229 0 => 'Deterministic, not cacheable',
230 1 => 'Decoder discretion, not cacheable',
231 2 => 'User discretion, not cacheable',
232 3 => 'External signal, not cacheable',
233 4 => 'Deterministic, cacheable',
234 5 => 'Decoder discretion, cacheable',
235 6 => 'User discretion, cacheable',
236 7 => 'External signal, cacheable',
237 },
238 },
239 6 => {
240 Name => 'IterationMinMax',
241 Format => 'int32u[2]',
242 },
243 14 => {
244 Name => 'SignalNumber',
245 Format => 'int32u',
246 },
247);
248
249# MNG DEFI chunk
250%Image::ExifTool::MNG::DefineObject = (
251 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
252 GROUPS => { 2 => 'Image' },
253 0 => {
254 Name => 'ObjectID',
255 Format => 'int16u',
256 },
257 2 => 'DoNotShow',
258 3 => 'ConcreteFlag',
259 4 => {
260 Name => 'XYLocation',
261 Format => 'int32u[2]',
262 },
263 12 => {
264 Name => 'ClippingBoundary',
265 Format => 'int32u[4]',
266 },
267);
268
269# MNG CLON chunk
270%Image::ExifTool::MNG::CloneObject = (
271 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
272 GROUPS => { 2 => 'Image' },
273 0 => {
274 Name => 'SourceID',
275 Format => 'int16u',
276 },
277 2 => {
278 Name => 'CloneID',
279 Format => 'int16u',
280 },
281 4 => {
282 Name => 'CloneType',
283 PrintConv => { 0 => 'Full', 1 => 'Parital', 2 => 'Renumber object' },
284 },
285 5 => 'DoNotShow',
286 6 => 'ConcreteFlag',
287 7 => {
288 Name => 'LocalDeltaType',
289 PrintConv => { 0 => 'Absolute', 1 => 'Relative' },
290 },
291 8 => {
292 Name => 'DeltaXY',
293 Format => 'int32u[2]',
294 },
295);
296
297# MNG PAST chunk
298%Image::ExifTool::MNG::PasteImage = (
299 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
300 GROUPS => { 2 => 'Image' },
301 0 => {
302 Name => 'DestinationID',
303 Format => 'int16u',
304 },
305 2 => {
306 Name => 'TargetDeltaType',
307 PrintConv => { 0 => 'Absolute', 1 => 'Relative' },
308 },
309 3 => {
310 Name => 'TargetXY',
311 Format => 'int32u[2]',
312 },
313 11 => {
314 Name => 'SourceID',
315 Format => 'int16u',
316 },
317 13 => {
318 Name => 'CompositionMode',
319 PrintConv => { 0 => 'Over', 1 => 'Replace', 2 => 'Under' },
320 },
321 14 => {
322 Name => 'Orientation',
323 PrintConv => {
324 0 => 'Same as source',
325 2 => 'Flipped left-right, then up-down',
326 4 => 'Flipped left-right',
327 6 => 'Flipped up-down',
328 8 => 'Tiled',
329 },
330 },
331 15 => {
332 Name => 'OffsetOrigin',
333 PrintConv => { 0 => 'Desination Origin', 1 => 'Target Origin' },
334 },
335 16 => {
336 Name => 'OffsetXY',
337 Format => 'int32u[2]',
338 },
339 24 => {
340 Name => 'BoundaryOrigin',
341 PrintConv => { 0 => 'Desination Origin', 1 => 'Target Origin' },
342 },
343 25 => {
344 Name => 'PastClippingBoundary',
345 Format => 'int32u[4]',
346 },
347);
348
349my %magMethod = (
350 0 => 'No Magnification',
351 1 => 'Pixel Replication',
352 2 => 'Linear Interpolation',
353 3 => 'Closest Pixel',
354 4 => 'Color Linear Interpolation and Alpha Closest Pixel',
355 5 => 'Color Closest Pixel and Alpha Linear Interpolation',
356);
357
358# MNG MAGN chunk
359%Image::ExifTool::MNG::MagnifyObject = (
360 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
361 GROUPS => { 2 => 'Image' },
362 0 => {
363 Name => 'FirstObjectID',
364 Format => 'int16u',
365 },
366 2 => {
367 Name => 'LastObjectID',
368 Format => 'int16u',
369 },
370 4 => {
371 Name => 'XMethod',
372 PrintConv => \%magMethod,
373 },
374 5 => {
375 Name => 'XMag',
376 Format => 'int16u',
377 },
378 7 => {
379 Name => 'YMag',
380 Format => 'int16u',
381 },
382 9 => {
383 Name => 'LeftMag',
384 Format => 'int16u',
385 },
386 11 => {
387 Name => 'RightMag',
388 Format => 'int16u',
389 },
390 13 => {
391 Name => 'TopMag',
392 Format => 'int16u',
393 },
394 15 => {
395 Name => 'BottomMag',
396 Format => 'int16u',
397 },
398 17 => {
399 Name => 'YMethod',
400 PrintConv => \%magMethod,
401 },
402);
403
404# MNG TERM chunk
405%Image::ExifTool::MNG::TerminationAction = (
406 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
407 GROUPS => { 2 => 'Image' },
408 0 => {
409 Name => 'TerminationAction',
410 PrintConv => {
411 0 => 'Show Last Frame',
412 1 => 'Display Nothing',
413 2 => 'Show First Frame',
414 3 => 'Repeat Sequence',
415 },
416 },
417 1 => {
418 Name => 'IterationEndAction',
419 PrintConv => {
420 0 => 'Show Last Frame',
421 1 => 'Display Nothing',
422 2 => 'Show First Frame',
423 },
424 },
425 2 => {
426 Name => 'Delay',
427 Format => 'int32u',
428 },
429 6 => {
430 Name => 'IterationMax',
431 Format => 'int32u',
432 },
433);
434
435# MNG BACK chunk
436%Image::ExifTool::MNG::Background = (
437 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
438 GROUPS => { 2 => 'Image' },
439 0 => {
440 Name => 'BackgroundColor',
441 Format => 'int16u[3]',
442 },
443 6 => {
444 Name => 'MandatoryBackground',
445 PrintConv => {
446 0 => 'Color and Image Advisory',
447 1 => 'Color Mandatory, Image Advisory',
448 2 => 'Color Advisory, Image Mandatory',
449 3 => 'Color and Image Mandatory',
450 },
451 },
452 7 => {
453 Name => 'BackgroundImageID',
454 Format => 'int16u',
455 },
456 9 => {
457 Name => 'BackgroundTiling',
458 PrintConv => { 0 => 'No', 1 => 'Yes' },
459 },
460);
461
462# MNG MOVE chunk
463%Image::ExifTool::MNG::MoveObjects = (
464 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
465 GROUPS => { 2 => 'Image' },
466 0 => {
467 Name => 'FirstObject',
468 Format => 'int16u',
469 },
470 2 => {
471 Name => 'LastObject',
472 Format => 'int16u',
473 },
474 4 => {
475 Name => 'DeltaType',
476 PrintConv => { 0 => 'Absolute', 1 => 'Relative' },
477 },
478 5 => {
479 Name => 'DeltaXY',
480 Format => 'int32u[2]',
481 },
482);
483
484# MNG CLIP chunk
485%Image::ExifTool::MNG::ClipObjects = (
486 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
487 GROUPS => { 2 => 'Image' },
488 0 => {
489 Name => 'FirstObject',
490 Format => 'int16u',
491 },
492 2 => {
493 Name => 'LastObject',
494 Format => 'int16u',
495 },
496 4 => {
497 Name => 'DeltaType',
498 PrintConv => { 0 => 'Absolute', 1 => 'Relative' },
499 },
500 5 => {
501 Name => 'ClipBoundary',
502 Format => 'int32u[4]',
503 },
504);
505
506# MNG SHOW chunk
507%Image::ExifTool::MNG::ShowObjects = (
508 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
509 GROUPS => { 2 => 'Image' },
510 0 => {
511 Name => 'FirstObject',
512 Format => 'int16u',
513 },
514 2 => {
515 Name => 'LastObject',
516 Format => 'int16u',
517 },
518 4 => 'ShowMode',
519);
520
521# MNG eXPI chunk
522%Image::ExifTool::MNG::ExportImage = (
523 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
524 GROUPS => { 2 => 'Image' },
525 0 => {
526 Name => 'SnapshotID',
527 Format => 'int16u',
528 },
529 2 => {
530 Name => 'SnapshotName',
531 Format => 'string',
532 },
533);
534
535# MNG fPRI chunk
536%Image::ExifTool::MNG::FramePriority = (
537 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
538 GROUPS => { 2 => 'Image' },
539 0 => {
540 Name => 'DeltaType',
541 PrintConv => { 0 => 'Absolute', 1 => 'Relative' },
542 },
543 2 => 'Priority',
544);
545
546# MNG DHDR chunk
547%Image::ExifTool::MNG::DeltaPNGHeader = (
548 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
549 GROUPS => { 2 => 'Image' },
550 0 => {
551 Name => 'ObjectID',
552 Format => 'int16u',
553 },
554 2 => {
555 Name => 'ImageType',
556 PrintConv => {
557 0 => 'Unspecified',
558 1 => 'PNG',
559 2 => 'JNG',
560 },
561 },
562 3 => {
563 Name => 'DeltaType',
564 PrintConv => {
565 0 => 'Full Replacement',
566 1 => 'Pixel Addition',
567 2 => 'Alpha Addition',
568 3 => 'Color Addition',
569 4 => 'Pixel Replacement',
570 5 => 'Alpha Replacement',
571 6 => 'Color Replacement',
572 7 => 'No Change',
573 },
574 },
575 4 => {
576 Name => 'BlockSize',
577 Format => 'int32u[2]',
578 },
579 12 => {
580 Name => 'BlockLocation',
581 Format => 'int32u[2]',
582 },
583);
584
585# MNG PROM chunk
586%Image::ExifTool::MNG::PromoteParent = (
587 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
588 GROUPS => { 2 => 'Image' },
589 0 => 'NewColorType',
590 1 => 'NewBitDepth',
591 2 => {
592 Name => 'FillMethod',
593 PrintConv => { 0 => 'Bit Replication', 1 => 'Zero Fill' },
594 },
595);
596
597# JNG JHDR chunk
598%Image::ExifTool::MNG::JNGHeader = (
599 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
600 GROUPS => { 2 => 'Image' },
601 0 => {
602 Name => 'ImageWidth',
603 Format => 'int32u',
604 },
605 4 => {
606 Name => 'ImageHeight',
607 Format => 'int32u',
608 },
609 8 => {
610 Name => 'ColorType',
611 PrintConv => {
612 8 => 'Gray',
613 10 => 'Color',
614 12 => 'Gray Alpha',
615 14 => 'Color Alpha',
616 },
617 },
618 9 => 'BitDepth',
619 10 => {
620 Name => 'Compression',
621 PrintConv => { 8 => 'Huffman-coded baseline JPEG' },
622 },
623 11 => {
624 Name => 'Interlace',
625 PrintConv => { 0 => 'Sequential', 8 => 'Progressive' },
626 },
627 12 => 'AlphaBitDepth',
628 13 => {
629 Name => 'AlphaCompression',
630 PrintConv => {
631 0 => 'MNG Grayscale IDAT',
632 8 => 'JNG 8-bit Grayscale JDAA',
633 },
634 },
635 14 => {
636 Name => 'AlphaFilter',
637 PrintConv => { 0 => 'Adaptive MNG (N/A for JPEG)' },
638 },
639 15 => {
640 Name => 'AlphaInterlace',
641 PrintConv => { 0 => 'Noninterlaced' },
642 },
643);
644
6451; # end
646
647__END__
648
649=head1 NAME
650
651Image::ExifTool::MNG - MNG and JNG meta information tags
652
653=head1 SYNOPSIS
654
655This module is used by Image::ExifTool
656
657=head1 DESCRIPTION
658
659This module contains definitions required by Image::ExifTool to read MNG
660(Multi-image Network Graphics) and JNG (JPEG Network Graphics) images.
661
662=head1 AUTHOR
663
664Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
665
666This library is free software; you can redistribute it and/or modify it
667under the same terms as Perl itself.
668
669=head1 REFERENCES
670
671=over 4
672
673=item L<http://www.libpng.org/pub/mng/>
674
675=back
676
677=head1 SEE ALSO
678
679L<Image::ExifTool::TagNames/MNG Tags>,
680L<Image::ExifTool::TagNames/PNG Tags>,
681L<Image::ExifTool(3pm)|Image::ExifTool>
682
683=cut
684
Note: See TracBrowser for help on using the repository browser.