/usr/share/perl5/Image/ExifTool/IPTC.pm is in libimage-exiftool-perl 9.46-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | #------------------------------------------------------------------------------
# File: IPTC.pm
#
# Description: Read IPTC meta information
#
# Revisions: Jan. 08/2003 - P. Harvey Created
# Feb. 05/2004 - P. Harvey Added support for records other than 2
#
# References: 1) http://www.iptc.org/IIM/
#------------------------------------------------------------------------------
package Image::ExifTool::IPTC;
use strict;
use vars qw($VERSION $AUTOLOAD %iptcCharset);
use Image::ExifTool qw(:DataAccess :Utils);
$VERSION = '1.49';
%iptcCharset = (
"\x1b%G" => 'UTF8',
# don't translate these (at least until we handle ISO 2022 shift codes)
# because the sets are only designated and not invoked
# "\x1b,A" => 'Latin', # G0 = ISO 8859-1 (similar to Latin1, but codes 0x80-0x9f are missing)
# "\x1b-A" => 'Latin', # G1 "
# "\x1b.A" => 'Latin', # G2
# "\x1b/A" => 'Latin', # G3
);
sub ProcessIPTC($$$);
sub WriteIPTC($$$);
sub CheckIPTC($$$);
sub PrintCodedCharset($);
sub PrintInvCodedCharset($);
# standard IPTC locations
# (MWG specifies locations only for JPEG, TIFF and PSD -- the rest are ExifTool-defined)
my %isStandardIPTC = (
'JPEG-APP13-Photoshop-IPTC' => 1,
'TIFF-IFD0-IPTC' => 1,
'PSD-IPTC' => 1,
'MIE-IPTC' => 1,
'EPS-Photoshop-IPTC' => 1,
'PS-Photoshop-IPTC' => 1,
);
my %fileFormat = (
0 => 'No ObjectData',
1 => 'IPTC-NAA Digital Newsphoto Parameter Record',
2 => 'IPTC7901 Recommended Message Format',
3 => 'Tagged Image File Format (Adobe/Aldus Image data)',
4 => 'Illustrator (Adobe Graphics data)',
5 => 'AppleSingle (Apple Computer Inc)',
6 => 'NAA 89-3 (ANPA 1312)',
7 => 'MacBinary II',
8 => 'IPTC Unstructured Character Oriented File Format (UCOFF)',
9 => 'United Press International ANPA 1312 variant',
10 => 'United Press International Down-Load Message',
11 => 'JPEG File Interchange (JFIF)',
12 => 'Photo-CD Image-Pac (Eastman Kodak)',
13 => 'Bit Mapped Graphics File [.BMP] (Microsoft)',
14 => 'Digital Audio File [.WAV] (Microsoft & Creative Labs)',
15 => 'Audio plus Moving Video [.AVI] (Microsoft)',
16 => 'PC DOS/Windows Executable Files [.COM][.EXE]',
17 => 'Compressed Binary File [.ZIP] (PKWare Inc)',
18 => 'Audio Interchange File Format AIFF (Apple Computer Inc)',
19 => 'RIFF Wave (Microsoft Corporation)',
20 => 'Freehand (Macromedia/Aldus)',
21 => 'Hypertext Markup Language [.HTML] (The Internet Society)',
22 => 'MPEG 2 Audio Layer 2 (Musicom), ISO/IEC',
23 => 'MPEG 2 Audio Layer 3, ISO/IEC',
24 => 'Portable Document File [.PDF] Adobe',
25 => 'News Industry Text Format (NITF)',
26 => 'Tape Archive [.TAR]',
27 => 'Tidningarnas Telegrambyra NITF version (TTNITF DTD)',
28 => 'Ritzaus Bureau NITF version (RBNITF DTD)',
29 => 'Corel Draw [.CDR]',
);
# main IPTC tag table
# Note: ALL entries in main IPTC table (except PROCESS_PROC) must be SubDirectory
# entries, each specifying a TagTable.
%Image::ExifTool::IPTC::Main = (
GROUPS => { 2 => 'Image' },
PROCESS_PROC => \&ProcessIPTC,
WRITE_PROC => \&WriteIPTC,
1 => {
Name => 'IPTCEnvelope',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::EnvelopeRecord',
},
},
2 => {
Name => 'IPTCApplication',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::ApplicationRecord',
},
},
3 => {
Name => 'IPTCNewsPhoto',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::NewsPhoto',
},
},
7 => {
Name => 'IPTCPreObjectData',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::PreObjectData',
},
},
8 => {
Name => 'IPTCObjectData',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::ObjectData',
},
},
9 => {
Name => 'IPTCPostObjectData',
Groups => { 1 => 'IPTC#' }, #(just so this shows up in group list)
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::PostObjectData',
},
},
240 => {
Name => 'IPTCFotoStation',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::FotoStation',
},
},
);
# Record 1 -- EnvelopeRecord
%Image::ExifTool::IPTC::EnvelopeRecord = (
GROUPS => { 2 => 'Other' },
WRITE_PROC => \&WriteIPTC,
CHECK_PROC => \&CheckIPTC,
WRITABLE => 1,
0 => {
Name => 'EnvelopeRecordVersion',
Format => 'int16u',
Mandatory => 1,
},
5 => {
Name => 'Destination',
Flags => 'List',
Groups => { 2 => 'Location' },
Format => 'string[0,1024]',
},
20 => {
Name => 'FileFormat',
Groups => { 2 => 'Image' },
Format => 'int16u',
PrintConv => \%fileFormat,
},
22 => {
Name => 'FileVersion',
Groups => { 2 => 'Image' },
Format => 'int16u',
},
30 => {
Name => 'ServiceIdentifier',
Format => 'string[0,10]',
},
40 => {
Name => 'EnvelopeNumber',
Format => 'digits[8]',
},
50 => {
Name => 'ProductID',
Flags => 'List',
Format => 'string[0,32]',
},
60 => {
Name => 'EnvelopePriority',
Format => 'digits[1]',
PrintConv => {
0 => '0 (reserved)',
1 => '1 (most urgent)',
2 => 2,
3 => 3,
4 => 4,
5 => '5 (normal urgency)',
6 => 6,
7 => 7,
8 => '8 (least urgent)',
9 => '9 (user-defined priority)',
},
},
70 => {
Name => 'DateSent',
Groups => { 2 => 'Time' },
Format => 'digits[8]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcDate($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
80 => {
Name => 'TimeSent',
Groups => { 2 => 'Time' },
Format => 'string[11]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifTime($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcTime($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
90 => {
Name => 'CodedCharacterSet',
Notes => q{
values are entered in the form "ESC X Y[, ...]". The escape sequence for
UTF-8 character coding is "ESC % G", but this is displayed as "UTF8" for
convenience. Either string may be used when writing. The value of this tag
affects the decoding of string values in the Application and NewsPhoto
records. This tag is marked as "unsafe" to prevent it from being copied by
default in a group operation because existing tags in the destination image
may use a different encoding. When creating a new IPTC record from scratch,
it is suggested that this be set to "UTF8" if special characters are a
possibility
},
Protected => 1,
Format => 'string[0,32]',
# convert ISO 2022 escape sequences to a more readable format
PrintConv => \&PrintCodedCharset,
PrintConvInv => \&PrintInvCodedCharset,
},
100 => {
Name => 'UniqueObjectName',
Format => 'string[14,80]',
},
120 => {
Name => 'ARMIdentifier',
Format => 'int16u',
},
122 => {
Name => 'ARMVersion',
Format => 'int16u',
},
);
# Record 2 -- ApplicationRecord
%Image::ExifTool::IPTC::ApplicationRecord = (
GROUPS => { 2 => 'Other' },
WRITE_PROC => \&WriteIPTC,
CHECK_PROC => \&CheckIPTC,
WRITABLE => 1,
0 => {
Name => 'ApplicationRecordVersion',
Format => 'int16u',
Mandatory => 1,
},
3 => {
Name => 'ObjectTypeReference',
Format => 'string[3,67]',
},
4 => {
Name => 'ObjectAttributeReference',
Flags => 'List',
Format => 'string[4,68]',
},
5 => {
Name => 'ObjectName',
Format => 'string[0,64]',
},
7 => {
Name => 'EditStatus',
Format => 'string[0,64]',
},
8 => {
Name => 'EditorialUpdate',
Format => 'digits[2]',
PrintConv => {
'01' => 'Additional language',
},
},
10 => {
Name => 'Urgency',
Format => 'digits[1]',
PrintConv => {
0 => '0 (reserved)',
1 => '1 (most urgent)',
2 => 2,
3 => 3,
4 => 4,
5 => '5 (normal urgency)',
6 => 6,
7 => 7,
8 => '8 (least urgent)',
9 => '9 (user-defined priority)',
},
},
12 => {
Name => 'SubjectReference',
Flags => 'List',
Format => 'string[13,236]',
},
15 => {
Name => 'Category',
Format => 'string[0,3]',
},
20 => {
Name => 'SupplementalCategories',
Flags => 'List',
Format => 'string[0,32]',
},
22 => {
Name => 'FixtureIdentifier',
Format => 'string[0,32]',
},
25 => {
Name => 'Keywords',
Flags => 'List',
Format => 'string[0,64]',
},
26 => {
Name => 'ContentLocationCode',
Flags => 'List',
Groups => { 2 => 'Location' },
Format => 'string[3]',
},
27 => {
Name => 'ContentLocationName',
Flags => 'List',
Groups => { 2 => 'Location' },
Format => 'string[0,64]',
},
30 => {
Name => 'ReleaseDate',
Groups => { 2 => 'Time' },
Format => 'digits[8]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcDate($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
35 => {
Name => 'ReleaseTime',
Groups => { 2 => 'Time' },
Format => 'string[11]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifTime($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcTime($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
37 => {
Name => 'ExpirationDate',
Groups => { 2 => 'Time' },
Format => 'digits[8]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcDate($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
38 => {
Name => 'ExpirationTime',
Groups => { 2 => 'Time' },
Format => 'string[11]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifTime($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcTime($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
40 => {
Name => 'SpecialInstructions',
Format => 'string[0,256]',
},
42 => {
Name => 'ActionAdvised',
Format => 'digits[2]',
PrintConv => {
'' => '',
'01' => 'Object Kill',
'02' => 'Object Replace',
'03' => 'Object Append',
'04' => 'Object Reference',
},
},
45 => {
Name => 'ReferenceService',
Flags => 'List',
Format => 'string[0,10]',
},
47 => {
Name => 'ReferenceDate',
Groups => { 2 => 'Time' },
Flags => 'List',
Format => 'digits[8]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcDate($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
50 => {
Name => 'ReferenceNumber',
Flags => 'List',
Format => 'digits[8]',
},
55 => {
Name => 'DateCreated',
Groups => { 2 => 'Time' },
Format => 'digits[8]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcDate($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
60 => {
Name => 'TimeCreated',
Groups => { 2 => 'Time' },
Format => 'string[11]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifTime($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcTime($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
62 => {
Name => 'DigitalCreationDate',
Groups => { 2 => 'Time' },
Format => 'digits[8]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcDate($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
63 => {
Name => 'DigitalCreationTime',
Groups => { 2 => 'Time' },
Format => 'string[11]',
Shift => 'Time',
ValueConv => 'Image::ExifTool::Exif::ExifTime($val)',
ValueConvInv => 'Image::ExifTool::IPTC::IptcTime($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InverseDateOrTime($val)',
},
65 => {
Name => 'OriginatingProgram',
Format => 'string[0,32]',
},
70 => {
Name => 'ProgramVersion',
Format => 'string[0,10]',
},
75 => {
Name => 'ObjectCycle',
Format => 'string[1]',
PrintConv => {
'a' => 'Morning',
'p' => 'Evening',
'b' => 'Both Morning and Evening',
},
},
80 => {
Name => 'By-line',
Flags => 'List',
Format => 'string[0,32]',
Groups => { 2 => 'Author' },
},
85 => {
Name => 'By-lineTitle',
Flags => 'List',
Format => 'string[0,32]',
Groups => { 2 => 'Author' },
},
90 => {
Name => 'City',
Format => 'string[0,32]',
Groups => { 2 => 'Location' },
},
92 => {
Name => 'Sub-location',
Format => 'string[0,32]',
Groups => { 2 => 'Location' },
},
95 => {
Name => 'Province-State',
Format => 'string[0,32]',
Groups => { 2 => 'Location' },
},
100 => {
Name => 'Country-PrimaryLocationCode',
Format => 'string[3]',
Groups => { 2 => 'Location' },
},
101 => {
Name => 'Country-PrimaryLocationName',
Format => 'string[0,64]',
Groups => { 2 => 'Location' },
},
103 => {
Name => 'OriginalTransmissionReference',
Format => 'string[0,32]',
},
105 => {
Name => 'Headline',
Format => 'string[0,256]',
},
110 => {
Name => 'Credit',
Groups => { 2 => 'Author' },
Format => 'string[0,32]',
},
115 => {
Name => 'Source',
Groups => { 2 => 'Author' },
Format => 'string[0,32]',
},
116 => {
Name => 'CopyrightNotice',
Groups => { 2 => 'Author' },
Format => 'string[0,128]',
},
118 => {
Name => 'Contact',
Flags => 'List',
Groups => { 2 => 'Author' },
Format => 'string[0,128]',
},
120 => {
Name => 'Caption-Abstract',
Format => 'string[0,2000]',
},
121 => {
Name => 'LocalCaption',
Format => 'string[0,256]', # (guess)
Notes => q{
I haven't found a reference for the format of tags 121, 184-188 and
225-232, so I have just make them writable as strings with
reasonable length. Beware that if this is wrong, other utilities
won't be able to read these tags as written by ExifTool
},
},
122 => {
Name => 'Writer-Editor',
Flags => 'List',
Groups => { 2 => 'Author' },
Format => 'string[0,32]',
},
125 => {
Name => 'RasterizedCaption',
Format => 'undef[7360]',
Binary => 1,
},
130 => {
Name => 'ImageType',
Groups => { 2 => 'Image' },
Format => 'string[2]',
},
131 => {
Name => 'ImageOrientation',
Groups => { 2 => 'Image' },
Format => 'string[1]',
PrintConv => {
P => 'Portrait',
L => 'Landscape',
S => 'Square',
},
},
135 => {
Name => 'LanguageIdentifier',
Format => 'string[2,3]',
},
150 => {
Name => 'AudioType',
Format => 'string[2]',
PrintConv => {
'1A' => 'Mono Actuality',
'2A' => 'Stereo Actuality',
'1C' => 'Mono Question and Answer Session',
'2C' => 'Stereo Question and Answer Session',
'1M' => 'Mono Music',
'2M' => 'Stereo Music',
'1Q' => 'Mono Response to a Question',
'2Q' => 'Stereo Response to a Question',
'1R' => 'Mono Raw Sound',
'2R' => 'Stereo Raw Sound',
'1S' => 'Mono Scener',
'2S' => 'Stereo Scener',
'0T' => 'Text Only',
'1V' => 'Mono Voicer',
'2V' => 'Stereo Voicer',
'1W' => 'Mono Wrap',
'2W' => 'Stereo Wrap',
},
},
151 => {
Name => 'AudioSamplingRate',
Format => 'digits[6]',
},
152 => {
Name => 'AudioSamplingResolution',
Format => 'digits[2]',
},
153 => {
Name => 'AudioDuration',
Format => 'digits[6]',
},
154 => {
Name => 'AudioOutcue',
Format => 'string[0,64]',
},
184 => {
Name => 'JobID',
Format => 'string[0,64]', # (guess)
},
185 => {
Name => 'MasterDocumentID',
Format => 'string[0,256]', # (guess)
},
186 => {
Name => 'ShortDocumentID',
Format => 'string[0,64]', # (guess)
},
187 => {
Name => 'UniqueDocumentID',
Format => 'string[0,128]', # (guess)
},
188 => {
Name => 'OwnerID',
Format => 'string[0,128]', # (guess)
},
200 => {
Name => 'ObjectPreviewFileFormat',
Groups => { 2 => 'Image' },
Format => 'int16u',
PrintConv => \%fileFormat,
},
201 => {
Name => 'ObjectPreviewFileVersion',
Groups => { 2 => 'Image' },
Format => 'int16u',
},
202 => {
Name => 'ObjectPreviewData',
Groups => { 2 => 'Image' },
Format => 'undef[0,256000]',
Binary => 1,
},
221 => {
Name => 'Prefs',
Groups => { 2 => 'Image' },
Format => 'string[0,64]',
Notes => 'PhotoMechanic preferences',
PrintConv => q{
$val =~ s[\s*(\d+):\s*(\d+):\s*(\d+):\s*(\S*)]
[Tagged:$1, ColorClass:$2, Rating:$3, FrameNum:$4];
return $val;
},
PrintConvInv => q{
$val =~ s[Tagged:\s*(\d+).*ColorClass:\s*(\d+).*Rating:\s*(\d+).*FrameNum:\s*(\S*)]
[$1:$2:$3:$4]is;
return $val;
},
},
225 => {
Name => 'ClassifyState',
Format => 'string[0,64]', # (guess)
},
228 => {
Name => 'SimilarityIndex',
Format => 'string[0,32]', # (guess)
},
230 => {
Name => 'DocumentNotes',
Format => 'string[0,1024]', # (guess)
},
231 => {
Name => 'DocumentHistory',
Format => 'string[0,256]', # (guess)
},
232 => {
Name => 'ExifCameraInfo',
Format => 'string[0,4096]', # (guess)
},
255 => { #PH
Name => 'CatalogSets',
List => 1,
Format => 'string[0,256]', # (guess)
Notes => 'written by iView MediaPro',
},
);
# Record 3 -- News photo
%Image::ExifTool::IPTC::NewsPhoto = (
GROUPS => { 2 => 'Image' },
WRITE_PROC => \&WriteIPTC,
CHECK_PROC => \&CheckIPTC,
WRITABLE => 1,
0 => {
Name => 'NewsPhotoVersion',
Format => 'int16u',
Mandatory => 1,
},
10 => {
Name => 'IPTCPictureNumber',
Format => 'string[16]',
Notes => '4 numbers: 1-Manufacturer ID, 2-Equipment ID, 3-Date, 4-Sequence',
PrintConv => 'Image::ExifTool::IPTC::ConvertPictureNumber($val)',
PrintConvInv => 'Image::ExifTool::IPTC::InvConvertPictureNumber($val)',
},
20 => {
Name => 'IPTCImageWidth',
Format => 'int16u',
},
30 => {
Name => 'IPTCImageHeight',
Format => 'int16u',
},
40 => {
Name => 'IPTCPixelWidth',
Format => 'int16u',
},
50 => {
Name => 'IPTCPixelHeight',
Format => 'int16u',
},
55 => {
Name => 'SupplementalType',
Format => 'int8u',
PrintConv => {
0 => 'Main Image',
1 => 'Reduced Resolution Image',
2 => 'Logo',
3 => 'Rasterized Caption',
},
},
60 => {
Name => 'ColorRepresentation',
Format => 'int16u',
PrintHex => 1,
PrintConv => {
0x000 => 'No Image, Single Frame',
0x100 => 'Monochrome, Single Frame',
0x300 => '3 Components, Single Frame',
0x301 => '3 Components, Frame Sequential in Multiple Objects',
0x302 => '3 Components, Frame Sequential in One Object',
0x303 => '3 Components, Line Sequential',
0x304 => '3 Components, Pixel Sequential',
0x305 => '3 Components, Special Interleaving',
0x400 => '4 Components, Single Frame',
0x401 => '4 Components, Frame Sequential in Multiple Objects',
0x402 => '4 Components, Frame Sequential in One Object',
0x403 => '4 Components, Line Sequential',
0x404 => '4 Components, Pixel Sequential',
0x405 => '4 Components, Special Interleaving',
},
},
64 => {
Name => 'InterchangeColorSpace',
Format => 'int8u',
PrintConv => {
1 => 'X,Y,Z CIE',
2 => 'RGB SMPTE',
3 => 'Y,U,V (K) (D65)',
4 => 'RGB Device Dependent',
5 => 'CMY (K) Device Dependent',
6 => 'Lab (K) CIE',
7 => 'YCbCr',
8 => 'sRGB',
},
},
65 => {
Name => 'ColorSequence',
Format => 'int8u',
},
66 => {
Name => 'ICC_Profile',
# ...could add SubDirectory support to read into this (if anybody cares)
Writable => 0,
Binary => 1,
},
70 => {
Name => 'ColorCalibrationMatrix',
Writable => 0,
Binary => 1,
},
80 => {
Name => 'LookupTable',
Writable => 0,
Binary => 1,
},
84 => {
Name => 'NumIndexEntries',
Format => 'int16u',
},
85 => {
Name => 'ColorPalette',
Writable => 0,
Binary => 1,
},
86 => {
Name => 'IPTCBitsPerSample',
Format => 'int8u',
},
90 => {
Name => 'SampleStructure',
Format => 'int8u',
PrintConv => {
0 => 'OrthogonalConstangSampling',
1 => 'Orthogonal4-2-2Sampling',
2 => 'CompressionDependent',
},
},
100 => {
Name => 'ScanningDirection',
Format => 'int8u',
PrintConv => {
0 => 'L-R, Top-Bottom',
1 => 'R-L, Top-Bottom',
2 => 'L-R, Bottom-Top',
3 => 'R-L, Bottom-Top',
4 => 'Top-Bottom, L-R',
5 => 'Bottom-Top, L-R',
6 => 'Top-Bottom, R-L',
7 => 'Bottom-Top, R-L',
},
},
102 => {
Name => 'IPTCImageRotation',
Format => 'int8u',
PrintConv => {
0 => 0,
1 => 90,
2 => 180,
3 => 270,
},
},
110 => {
Name => 'DataCompressionMethod',
Format => 'int32u',
},
120 => {
Name => 'QuantizationMethod',
Format => 'int8u',
PrintConv => {
0 => 'Linear Reflectance/Transmittance',
1 => 'Linear Density',
2 => 'IPTC Ref B',
3 => 'Linear Dot Percent',
4 => 'AP Domestic Analogue',
5 => 'Compression Method Specific',
6 => 'Color Space Specific',
7 => 'Gamma Compensated',
},
},
125 => {
Name => 'EndPoints',
Writable => 0,
Binary => 1,
},
130 => {
Name => 'ExcursionTolerance',
Format => 'int8u',
PrintConv => {
0 => 'Not Allowed',
1 => 'Allowed',
},
},
135 => {
Name => 'BitsPerComponent',
Format => 'int8u',
},
140 => {
Name => 'MaximumDensityRange',
Format => 'int16u',
},
145 => {
Name => 'GammaCompensatedValue',
Format => 'int16u',
},
);
# Record 7 -- Pre-object Data
%Image::ExifTool::IPTC::PreObjectData = (
# (not actually writable, but used in BuildTagLookup to recognize IPTC tables)
WRITE_PROC => \&WriteIPTC,
10 => {
Name => 'SizeMode',
Format => 'int8u',
PrintConv => {
0 => 'Size Not Known',
1 => 'Size Known',
},
},
20 => {
Name => 'MaxSubfileSize',
Format => 'int32u',
},
90 => {
Name => 'ObjectSizeAnnounced',
Format => 'int32u',
},
95 => {
Name => 'MaximumObjectSize',
Format => 'int32u',
},
);
# Record 8 -- ObjectData
%Image::ExifTool::IPTC::ObjectData = (
WRITE_PROC => \&WriteIPTC,
10 => {
Name => 'SubFile',
Flags => 'List',
Binary => 1,
},
);
# Record 9 -- PostObjectData
%Image::ExifTool::IPTC::PostObjectData = (
WRITE_PROC => \&WriteIPTC,
10 => {
Name => 'ConfirmedObjectSize',
Format => 'int32u',
},
);
# Record 240 -- FotoStation proprietary data (ref PH)
%Image::ExifTool::IPTC::FotoStation = (
GROUPS => { 2 => 'Other' },
WRITE_PROC => \&WriteIPTC,
CHECK_PROC => \&CheckIPTC,
WRITABLE => 1,
);
# IPTC Composite tags
%Image::ExifTool::IPTC::Composite = (
GROUPS => { 2 => 'Image' },
DateTimeCreated => {
Description => 'Date/Time Created',
Groups => { 2 => 'Time' },
Require => {
0 => 'IPTC:DateCreated',
1 => 'IPTC:TimeCreated',
},
ValueConv => '"$val[0] $val[1]"',
PrintConv => '$self->ConvertDateTime($val)',
},
DigitalCreationDateTime => {
Description => 'Digital Creation Date/Time',
Groups => { 2 => 'Time' },
Require => {
0 => 'IPTC:DigitalCreationDate',
1 => 'IPTC:DigitalCreationTime',
},
ValueConv => '"$val[0] $val[1]"',
PrintConv => '$self->ConvertDateTime($val)',
},
);
# add our composite tags
Image::ExifTool::AddCompositeTags('Image::ExifTool::IPTC');
#------------------------------------------------------------------------------
# AutoLoad our writer routines when necessary
#
sub AUTOLOAD
{
return Image::ExifTool::DoAutoLoad($AUTOLOAD, @_);
}
#------------------------------------------------------------------------------
# Print conversion for CodedCharacterSet
# Inputs: 0) value
sub PrintCodedCharset($)
{
my $val = shift;
return $iptcCharset{$val} if $iptcCharset{$val};
$val =~ s/(.)/ $1/g;
$val =~ s/ \x1b/, ESC/g;
$val =~ s/^,? //;
return $val;
}
#------------------------------------------------------------------------------
# Handle CodedCharacterSet
# Inputs: 0) ExifTool ref, 1) CodedCharacterSet value
# Returns: IPTC character set if translation required (or 'bad' if unknown)
sub HandleCodedCharset($$)
{
my ($et, $val) = @_;
my $xlat = $iptcCharset{$val};
unless ($xlat) {
if ($val =~ /^\x1b\x25/) {
# some unknown character set invoked
$xlat = 'bad'; # flag unsupported coding
} else {
$xlat = $et->Options('CharsetIPTC');
}
}
# no need to translate if Charset is the same
undef $xlat if $xlat eq $et->Options('Charset');
return $xlat;
}
#------------------------------------------------------------------------------
# Encode or decode coded string
# Inputs: 0) ExifTool ref, 1) value ptr, 2) IPTC charset (or 'bad') ref
# 3) flag set to decode (read) value from IPTC
# Updates value on return
sub TranslateCodedString($$$$)
{
my ($et, $valPtr, $xlatPtr, $read) = @_;
if ($$xlatPtr eq 'bad') {
$et->Warn('Some IPTC characters not converted (unsupported CodedCharacterSet)');
undef $$xlatPtr;
} elsif (not $read) {
$$valPtr = $et->Decode($$valPtr, undef, undef, $$xlatPtr);
} elsif ($$valPtr !~ /[\x14\x15\x1b]/) {
$$valPtr = $et->Decode($$valPtr, $$xlatPtr);
} else {
# don't yet support reading ISO 2022 shifted character sets
$et->WarnOnce('Some IPTC characters not converted (ISO 2022 shifting not supported)');
}
}
#------------------------------------------------------------------------------
# Is this IPTC in a standard location?
# Inputs: 0) Current metadata path string
# Returns: true if path is standard
sub IsStandardIPTC($)
{
my $path = shift;
return $isStandardIPTC{$path};
}
#------------------------------------------------------------------------------
# get IPTC info
# Inputs: 0) ExifTool object reference, 1) dirInfo reference
# 2) reference to tag table
# Returns: 1 on success, 0 otherwise
sub ProcessIPTC($$$)
{
my ($et, $dirInfo, $tagTablePtr) = @_;
my $dataPt = $$dirInfo{DataPt};
my $pos = $$dirInfo{DirStart} || 0;
my $dirLen = $$dirInfo{DirLen} || 0;
my $dirEnd = $pos + $dirLen;
my $verbose = $et->Options('Verbose');
my $success = 0;
my ($lastRec, $recordPtr, $recordName);
$verbose and $dirInfo and $et->VerboseDir('IPTC', 0, $$dirInfo{DirLen});
if ($tagTablePtr eq \%Image::ExifTool::IPTC::Main) {
# calculate MD5 if Digest::MD5 is available (for standard IPTC only)
my $path = $et->MetadataPath();
if (IsStandardIPTC($path)) {
my $md5;
if (eval 'require Digest::MD5') {
if ($pos or $dirLen != length($$dataPt)) {
$md5 = Digest::MD5::md5(substr $$dataPt, $pos, $dirLen);
} else {
$md5 = Digest::MD5::md5($$dataPt);
}
} else {
# a zero digest indicates IPTC exists but we don't have Digest::MD5
$md5 = "\0" x 16;
}
$et->FoundTag('CurrentIPTCDigest', $md5);
} elsif ($Image::ExifTool::MWG::strict and $$et{FILE_TYPE} =~ /^(JPEG|TIFF|PSD)$/) {
# ignore non-standard IPTC while in strict MWG compatibility mode
$et->Warn("Ignored non-standard IPTC at $path");
return 1;
}
# set family 1 group name if multiple IPTC directories
my $dirCount = ($$et{DIR_COUNT}{IPTC} || 0) + 1;
$$et{DIR_COUNT}{IPTC} = $dirCount;
$$et{SET_GROUP1} = '+' . $dirCount if $dirCount > 1;
}
# begin by assuming default IPTC encoding
my $xlat = $et->Options('CharsetIPTC');
undef $xlat if $xlat eq $et->Options('Charset');
# quick check for improperly byte-swapped IPTC
if ($dirLen >= 4 and substr($$dataPt, $pos, 1) ne "\x1c" and
substr($$dataPt, $pos + 3, 1) eq "\x1c")
{
$et->Warn('IPTC data was improperly byte-swapped');
my $newData = pack('N*', unpack('V*', substr($$dataPt, $pos, $dirLen) . "\0\0\0"));
$dataPt = \$newData;
$pos = 0;
$dirEnd = $pos + $dirLen;
# NOTE: MUST NOT access $dirInfo DataPt, DirStart or DataLen after this!
}
# extract IPTC as a block if specified
if ($$et{REQ_TAG_LOOKUP}{iptc} or ($$et{TAGS_FROM_FILE} and
not $$et{EXCL_TAG_LOOKUP}{iptc}))
{
if ($pos or $dirLen != length($$dataPt)) {
$et->FoundTag('IPTC', substr($$dataPt, $pos, $dirLen));
} else {
$et->FoundTag('IPTC', $$dataPt);
}
}
while ($pos + 5 <= $dirEnd) {
my $buff = substr($$dataPt, $pos, 5);
my ($id, $rec, $tag, $len) = unpack("CCCn", $buff);
unless ($id == 0x1c) {
unless ($id) {
# scan the rest of the data an give warning unless all zeros
# (iMatch pads the IPTC block with nulls for some reason)
my $remaining = substr($$dataPt, $pos, $dirEnd - $pos);
last unless $remaining =~ /[^\0]/;
}
$et->Warn(sprintf('Bad IPTC data tag (marker 0x%x)',$id));
last;
}
$pos += 5; # step to after field header
# handle extended IPTC entry if necessary
if ($len & 0x8000) {
my $n = $len & 0x7fff; # get num bytes in length field
if ($pos + $n > $dirEnd or $n > 8) {
$et->VPrint(0, "Invalid extended IPTC entry (dataset $rec:$tag, len $len)\n");
$success = 0;
last;
}
# determine length (a big-endian, variable sized int)
for ($len = 0; $n; ++$pos, --$n) {
$len = $len * 256 + ord(substr($$dataPt, $pos, 1));
}
}
if ($pos + $len > $dirEnd) {
$et->VPrint(0, "Invalid IPTC entry (dataset $rec:$tag, len $len)\n");
$success = 0;
last;
}
if (not defined $lastRec or $lastRec != $rec) {
my $tableInfo = $tagTablePtr->{$rec};
unless ($tableInfo) {
$et->WarnOnce("Unrecognized IPTC record $rec (ignored)");
$pos += $len;
next; # ignore this entry
}
my $tableName = $tableInfo->{SubDirectory}->{TagTable};
unless ($tableName) {
$et->Warn("No table for IPTC record $rec!");
last; # this shouldn't happen
}
$recordName = $$tableInfo{Name};
$recordPtr = Image::ExifTool::GetTagTable($tableName);
$et->VPrint(0,$$et{INDENT},"-- $recordName record --\n");
$lastRec = $rec;
}
my $val = substr($$dataPt, $pos, $len);
# add tagInfo for all unknown tags:
unless ($$recordPtr{$tag}) {
# - no Format so format is auto-detected
# - no Name so name is generated automatically with decimal tag number
AddTagToTable($recordPtr, $tag, { Unknown => 1 });
}
my $tagInfo = $et->GetTagInfo($recordPtr, $tag);
my $format;
# (could use $$recordPtr{FORMAT} if no Format below, but don't do this to
# be backward compatible with improperly written PhotoMechanic tags)
$format = $$tagInfo{Format} if $tagInfo;
# use logic to determine format if not specified
unless ($format) {
$format = 'int' if $len <= 4 and $len != 3 and $val =~ /[\0-\x08]/;
}
if ($format) {
if ($format =~ /^int/) {
if ($len <= 8) { # limit integer conversion to 8 bytes long
$val = 0;
my $i;
for ($i=0; $i<$len; ++$i) {
$val = $val * 256 + ord(substr($$dataPt, $pos+$i, 1));
}
}
} elsif ($format =~ /^string/) {
$val =~ s/\0+$//; # some braindead softwares add null terminators
if ($rec == 1) {
# handle CodedCharacterSet tag
$xlat = HandleCodedCharset($et, $val) if $tag == 90;
# translate characters if necessary and special characters exist
} elsif ($xlat and $rec < 7 and $val =~ /[\x80-\xff]/) {
# translate to specified character set
TranslateCodedString($et, \$val, \$xlat, 1);
}
} elsif ($format =~ /^digits/) {
$val =~ s/\0+$//;
} elsif ($format !~ /^undef/) {
warn("Invalid IPTC format: $format");
}
}
$verbose and $et->VerboseInfo($tag, $tagInfo,
Table => $tagTablePtr,
Value => $val,
DataPt => $dataPt,
DataPos => $$dirInfo{DataPos},
Size => $len,
Start => $pos,
Extra => ", $recordName record",
Format => $format,
);
$et->FoundTag($tagInfo, $val) if $tagInfo;
$success = 1;
$pos += $len; # increment to next field
}
delete $$et{SET_GROUP1};
return $success;
}
1; # end
__END__
=head1 NAME
Image::ExifTool::IPTC - Read IPTC meta information
=head1 SYNOPSIS
This module is loaded automatically by Image::ExifTool when required.
=head1 DESCRIPTION
This module contains definitions required by Image::ExifTool to interpret
IPTC (International Press Telecommunications Council) meta information in
image files.
=head1 AUTHOR
Copyright 2003-2014, Phil Harvey (phil at owl.phy.queensu.ca)
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 REFERENCES
=over 4
=item L<http://www.iptc.org/IIM/>
=back
=head1 SEE ALSO
L<Image::ExifTool::TagNames/IPTC Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
|