/usr/share/perl5/Image/ExifTool/NikonCapture.pm is in libimage-exiftool-perl 10.80-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 | #------------------------------------------------------------------------------
# File: NikonCapture.pm
#
# Description: Read/write Nikon Capture information
#
# Revisions: 11/08/2005 - P. Harvey Created
# 10/10/2008 - P. Harvey Updated for Capture NX 2
# 16/04/2011 - P. Harvey Decode NikonCaptureEditVersions
#
# References: 1) http://www.cybercom.net/~dcoffin/dcraw/
# IB) Iliah Borg private communication (LibRaw)
#------------------------------------------------------------------------------
package Image::ExifTool::NikonCapture;
use strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::Exif;
$VERSION = '1.14';
sub ProcessNikonCapture($$$);
# common print conversions
my %offOn = ( 0 => 'Off', 1 => 'On' );
my %noYes = ( 0 => 'No', 1 => 'Yes' );
my %unsharpColor = (
0 => 'RGB',
1 => 'Red',
2 => 'Green',
3 => 'Blue',
4 => 'Yellow',
5 => 'Magenta',
6 => 'Cyan',
);
# Nikon Capture data (ref PH)
%Image::ExifTool::NikonCapture::Main = (
PROCESS_PROC => \&ProcessNikonCapture,
WRITE_PROC => \&WriteNikonCapture,
CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
NOTES => q{
This information is written by the Nikon Capture software in tag 0x0e01 of
the maker notes of NEF images.
},
# 0x007ddc9d contains contrast information
0x008ae85e => {
Name => 'LCHEditor',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x0c89224b => {
Name => 'ColorAberrationControl',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x116fea21 => {
Name => 'HighlightData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::HighlightData',
},
},
0x2175eb78 => {
Name => 'D-LightingHQ',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x2fc08431 => {
Name => 'StraightenAngle',
Writable => 'double',
},
0x374233e0 => {
Name => 'CropData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::CropData',
},
},
0x39c456ac => {
Name => 'PictureCtrl',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::PictureCtrl',
},
},
0x3cfc73c6 => {
Name => 'RedEyeData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::RedEyeData',
},
},
0x3d136244 => {
Name => 'EditVersionName',
Writable => 'string', # (null terminated)
},
# 0x3e726567 added when I rotated by 90 degrees
0x416391c6 => {
Name => 'QuickFix',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x56a54260 => {
Name => 'Exposure',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::Exposure',
},
},
0x5f0e7d23 => {
Name => 'ColorBooster',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x6a6e36b6 => {
Name => 'D-LightingHQSelected',
Writable => 'int8u',
PrintConv => \%noYes,
},
0x753dcbc0 => {
Name => 'NoiseReduction',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43200 => {
Name => 'UnsharpMask',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43201 => {
Name => 'Curves',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43202 => {
Name => 'ColorBalanceAdj',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43203 => {
Name => 'AdvancedRaw',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43204 => {
Name => 'WhiteBalanceAdj',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43205 => {
Name => 'VignetteControl',
Writable => 'int8u',
PrintConv => \%offOn,
},
0x76a43206 => {
Name => 'FlipHorizontal',
Writable => 'int8u',
PrintConv => \%noYes,
},
0x76a43207 => { # rotation angle in degrees
Name => 'Rotation',
Writable => 'int16u',
},
0x083a1a25 => {
Name => 'HistogramXML',
Writable => 'undef',
Binary => 1,
AdjustSize => 4, # patch Nikon bug
},
0x84589434 => {
Name => 'BrightnessData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::Brightness',
},
},
# 0x88f55e48 - related to QuickFix
0x890ff591 => {
Name => 'D-LightingHQData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::DLightingHQ',
},
},
0x926f13e0 => {
Name => 'NoiseReductionData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::NoiseReduction',
},
},
0x9ef5f6e0 => {
Name => 'IPTCData',
SubDirectory => {
TagTable => 'Image::ExifTool::IPTC::Main',
},
},
# 0xa7264a72 - related to QuickFix
0xab5eca5e => {
Name => 'PhotoEffects',
Writable => 'int8u',
PrintConv => \%offOn,
},
0xac6bd5c0 => {
Name => 'VignetteControlIntensity',
Writable => 'int16s',
},
0xb0384e1e => {
Name => 'PhotoEffectsData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::PhotoEffects',
},
},
0xb999a36f => {
Name => 'ColorBoostData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::ColorBoost',
},
},
0xbf3c6c20 => {
Name => 'WBAdjData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::WBAdjData',
},
},
0xce5554aa => {
Name => 'D-LightingHS',
Writable => 'int8u',
PrintConv => \%offOn,
},
0xe2173c47 => {
Name => 'PictureControl',
Writable => 'int8u',
PrintConv => \%offOn,
},
0xe37b4337 => {
Name => 'D-LightingHSData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::DLightingHS',
},
},
0xe42b5161 => {
Name => 'UnsharpData',
SubDirectory => {
TagTable => 'Image::ExifTool::NikonCapture::UnsharpData',
},
},
0xe9651831 => {
Name => 'PhotoEffectHistoryXML',
Binary => 1,
Writable => 'undef',
},
0xfe28a44f => {
Name => 'AutoRedEye',
Writable => 'int8u',
PrintConv => \%offOn, # (have seen a value of 28 here for older software?)
},
0xfe443a45 => {
Name => 'ImageDustOff',
Writable => 'int8u',
PrintConv => \%offOn,
},
);
%Image::ExifTool::NikonCapture::UnsharpData = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => 'UnsharpCount',
19 => { Name => 'Unsharp1Color', Format => 'int16u', PrintConv => \%unsharpColor },
23 => { Name => 'Unsharp1Intensity', Format => 'int16u' },
25 => { Name => 'Unsharp1HaloWidth', Format => 'int16u' },
27 => 'Unsharp1Threshold',
46 => { Name => 'Unsharp2Color', Format => 'int16u', PrintConv => \%unsharpColor },
50 => { Name => 'Unsharp2Intensity', Format => 'int16u' },
52 => { Name => 'Unsharp2HaloWidth', Format => 'int16u' },
54 => 'Unsharp2Threshold',
73 => { Name => 'Unsharp3Color', Format => 'int16u', PrintConv => \%unsharpColor },
77 => { Name => 'Unsharp3Intensity', Format => 'int16u' },
79 => { Name => 'Unsharp3HaloWidth', Format => 'int16u' },
81 => 'Unsharp3Threshold',
100 => { Name => 'Unsharp4Color', Format => 'int16u', PrintConv => \%unsharpColor },
104 => { Name => 'Unsharp4Intensity', Format => 'int16u' },
106 => { Name => 'Unsharp4HaloWidth', Format => 'int16u' },
108 => 'Unsharp4Threshold',
# there could be more, but I grow bored of this... :P
);
%Image::ExifTool::NikonCapture::DLightingHS = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int32u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => 'D-LightingHSAdjustment',
1 => 'D-LightingHSColorBoost',
);
%Image::ExifTool::NikonCapture::DLightingHQ = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int32u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => 'D-LightingHQShadow',
1 => 'D-LightingHQHighlight',
2 => 'D-LightingHQColorBoost',
);
%Image::ExifTool::NikonCapture::ColorBoost = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => {
Name => 'ColorBoostType',
PrintConv => {
0 => 'Nature',
1 => 'People',
},
},
1 => {
Name => 'ColorBoostLevel',
Format => 'int32u',
},
);
%Image::ExifTool::NikonCapture::WBAdjData = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0x00 => {
Name => 'WBAdjRedBalance',
Format => 'double',
},
0x08 => {
Name => 'WBAdjBlueBalance',
Format => 'double',
},
0x10 => {
Name => 'WBAdjMode',
PrintConv => {
1 => 'Use Gray Point',
2 => 'Recorded Value',
3 => 'Use Temperature',
4 => 'Calculate Automatically',
5 => 'Auto2', #IB
6 => 'Underwater', #IB
7 => 'Auto1',
},
},
0x14 => { #IB
Name => 'WBAdjLighting',
Format => 'int16u',
PrintHex => 1,
PrintConv => {
0x000 => 'None',
0x100 => 'Incandescent',
0x200 => 'Daylight (direct sunlight)',
0x201 => 'Daylight (shade)',
0x202 => 'Daylight (cloudy)',
0x300 => 'Standard Fluorescent (warm white)',
0x301 => 'Standard Fluorescent (3700K)',
0x302 => 'Standard Fluorescent (cool white)',
0x303 => 'Standard Fluorescent (5000K)',
0x304 => 'Standard Fluorescent (daylight)',
0x305 => 'Standard Fluorescent (high temperature mercury vapor)',
0x400 => 'High Color Rendering Fluorescent (warm white)',
0x401 => 'High Color Rendering Fluorescent (3700K)',
0x402 => 'High Color Rendering Fluorescent (cool white)',
0x403 => 'High Color Rendering Fluorescent (5000K)',
0x404 => 'High Color Rendering Fluorescent (daylight)',
0x500 => 'Flash',
0x501 => 'Flash (FL-G1 filter)',
0x502 => 'Flash (FL-G2 filter)',
0x503 => 'Flash (TN-A1 filter)',
0x504 => 'Flash (TN-A2 filter)',
0x600 => 'Sodium Vapor Lamps',
# 0x1002 => seen for WBAdjMode modes of Underwater and Calculate Automatically
},
},
0x18 => {
Name => 'WBAdjTemperature',
Format => 'int16u',
},
0x25 => {
Name => 'WBAdjTint',
Format => 'int32s',
},
);
%Image::ExifTool::NikonCapture::PhotoEffects = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => {
Name => 'PhotoEffectsType',
PrintConv => {
0 => 'None',
1 => 'B&W',
2 => 'Sepia',
3 => 'Tinted',
},
},
4 => {
Name => 'PhotoEffectsRed',
Format => 'int16s',
},
6 => {
Name => 'PhotoEffectsGreen',
Format => 'int16s',
},
8 => {
Name => 'PhotoEffectsBlue',
Format => 'int16s',
},
);
%Image::ExifTool::NikonCapture::Brightness = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => {
Name => 'BrightnessAdj',
Format => 'double',
ValueConv => '$val * 50',
ValueConvInv => '$val / 50',
},
8 => {
Name => 'EnhanceDarkTones',
PrintConv => \%offOn,
},
);
%Image::ExifTool::NikonCapture::NoiseReduction = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0x04 => {
Name => 'EdgeNoiseReduction',
PrintConv => \%offOn,
},
0x05 => {
Name => 'ColorMoireReductionMode',
PrintConv => {
0 => 'Off',
1 => 'Low',
2 => 'Medium',
3 => 'High',
},
},
0x09 => {
Name => 'NoiseReductionIntensity',
Format => 'int32u',
},
0x0d => {
Name => 'NoiseReductionSharpness',
Format => 'int32u',
},
0x11 => {
Name => 'NoiseReductionMethod',
Format => 'int16u',
PrintConv => {
0 => 'Faster',
1 => 'Better Quality',
2 => 'Better Quality 2013',
},
},
0x15 => {
Name => 'ColorMoireReduction',
PrintConv => \%offOn,
},
0x17 => {
Name => 'NoiseReduction',
PrintConv => \%offOn,
},
0x18 => {
Name => 'ColorNoiseReductionIntensity',
Format => 'int32u',
},
0x1c => {
Name => 'ColorNoiseReductionSharpness',
Format => 'int32u',
},
);
%Image::ExifTool::NikonCapture::CropData = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0x1e => {
Name => 'CropLeft',
Format => 'double',
ValueConv => '$val / 2',
ValueConvInv => '$val * 2',
},
0x26 => {
Name => 'CropTop',
Format => 'double',
ValueConv => '$val / 2',
ValueConvInv => '$val * 2',
},
0x2e => {
Name => 'CropRight',
Format => 'double',
ValueConv => '$val / 2',
ValueConvInv => '$val * 2',
},
0x36 => {
Name => 'CropBottom',
Format => 'double',
ValueConv => '$val / 2',
ValueConvInv => '$val * 2',
},
0x8e => {
Name => 'CropOutputWidthInches',
Format => 'double',
},
0x96 => {
Name => 'CropOutputHeightInches',
Format => 'double',
},
0x9e => {
Name => 'CropScaledResolution',
Format => 'double',
},
0xae => {
Name => 'CropSourceResolution',
Format => 'double',
ValueConv => '$val / 2',
ValueConvInv => '$val * 2',
},
0xb6 => {
Name => 'CropOutputResolution',
Format => 'double',
},
0xbe => {
Name => 'CropOutputScale',
Format => 'double',
},
0xc6 => {
Name => 'CropOutputWidth',
Format => 'double',
},
0xce => {
Name => 'CropOutputHeight',
Format => 'double',
},
0xd6 => {
Name => 'CropOutputPixels',
Format => 'double',
},
);
%Image::ExifTool::NikonCapture::PictureCtrl = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0x00 => {
Name => 'PictureControlActive',
PrintConv => \%offOn,
},
0x13 => {
Name => 'PictureControlMode',
Format => 'string[16]',
},
# 0x29 changes with Hue and Sharpening
0x2a => {
Name => 'QuickAdjust',
ValueConv => '$val - 128',
ValueConvInv => '$val + 128',
},
0x2b => {
Name => 'SharpeningAdj',
ValueConv => '$val ? $val - 128 : "Auto"',
ValueConvInv => '$val=~/\d/ ? $val + 128 : 0',
},
0x2c => {
Name => 'ContrastAdj',
ValueConv => '$val ? $val - 128 : "Auto"',
ValueConvInv => '$val=~/\d/ ? $val + 128 : 0',
},
0x2d => {
Name => 'BrightnessAdj',
ValueConv => '$val ? $val - 128 : "Auto"', # no "Auto" mode (yet) for this setting
ValueConvInv => '$val=~/\d/ ? $val + 128 : 0',
},
0x2e => {
Name => 'SaturationAdj',
ValueConv => '$val ? $val - 128 : "Auto"',
ValueConvInv => '$val=~/\d/ ? $val + 128 : 0',
},
0x2f => {
Name => 'HueAdj',
ValueConv => '$val - 128',
ValueConvInv => '$val + 128',
},
# 0x37 changed from 0 to 2 when Picture Control is enabled (and no active DLighting)
);
%Image::ExifTool::NikonCapture::RedEyeData = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => {
Name => 'RedEyeCorrection',
PrintConv => {
0 => 'Off',
1 => 'Automatic',
2 => 'Click on Eyes',
},
},
);
%Image::ExifTool::NikonCapture::Exposure = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8u',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0x00 => {
Name => 'ExposureAdj',
Format => 'int16s',
ValueConv => '$val / 100',
ValueConvInv => '$val * 100',
},
0x12 => {
Name => 'ExposureAdj2',
Format => 'double',
PrintConv => 'sprintf("%.4f", $val)',
PrintConvInv => '$val',
},
0x24 => {
Name => 'ActiveD-Lighting',
PrintConv => \%offOn,
},
0x25 => {
Name => 'ActiveD-LightingMode',
PrintConv => {
0 => 'Unchanged',
1 => 'Off',
2 => 'Low',
3 => 'Normal',
4 => 'High',
6 => 'Extra High',
7 => 'Extra High 1',
8 => 'Extra High 2',
},
},
);
%Image::ExifTool::NikonCapture::HighlightData = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
WRITABLE => 1,
FORMAT => 'int8s',
FIRST_ENTRY => 0,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
0 => 'ShadowProtection',
1 => 'SaturationAdj',
6 => 'HighlightProtection',
);
#------------------------------------------------------------------------------
# write Nikon Capture data (ref 1)
# Inputs: 0) ExifTool object reference, 1) reference to directory information
# 2) pointer to tag table
# Returns: 1 on success
sub WriteNikonCapture($$$)
{
my ($et, $dirInfo, $tagTablePtr) = @_;
$et or return 1; # allow dummy access to autoload this package
# no need to edit this information unless necessary
unless ($$et{EDIT_DIRS}{MakerNotes} or $$et{EDIT_DIRS}{IPTC}) {
return undef;
}
my $dataPt = $$dirInfo{DataPt};
my $dirStart = $$dirInfo{DirStart};
my $dirLen = $$dirInfo{DirLen};
if ($dirLen < 22) {
$et->Warn('Short Nikon Capture Data',1);
return undef;
}
# make sure the capture data is properly contained
SetByteOrder('II');
my $tagID = Get32u($dataPt, $dirStart);
# sometimes size includes 18 header bytes, and other times it doesn't (eg. ViewNX 2.1.1)
my $size = Get32u($dataPt, $dirStart + 18);
my $pad = $dirLen - $size - 18;
unless ($tagID == 0x7a86a940 and ($pad >= 0 or $pad == -18)) {
$et->Warn('Unrecognized Nikon Capture Data header');
return undef;
}
# determine if there is any data after this block
if ($pad > 0) {
$pad = substr($$dataPt, $dirStart + 18 + $size, $pad);
$dirLen = $size + 18;
} else {
$pad = '';
}
my $outBuff = '';
my $pos;
my $newTags = $et->GetNewTagInfoHash($tagTablePtr);
my $dirEnd = $dirStart + $dirLen;
# loop through all entries in the Nikon Capture data
for ($pos=$dirStart+22; $pos+22<$dirEnd; $pos+=22+$size) {
$tagID = Get32u($dataPt, $pos);
$size = Get32u($dataPt, $pos + 18) - 4;
last if $size < 0 or $pos + 22 + $size > $dirEnd;
my $tagInfo = $et->GetTagInfo($tagTablePtr, $tagID);
if ($tagInfo) {
my $newVal;
if ($$tagInfo{SubDirectory}) {
# rewrite the subdirectory
my %subdirInfo = (
DataPt => $dataPt,
DirStart => $pos + 22,
DirLen => $size,
);
my $subTable = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
# ignore minor errors in IPTC since there is typically trailing garbage
my $oldSetting = $et->Options('IgnoreMinorErrors');
$$tagInfo{Name} =~ /IPTC/ and $et->Options(IgnoreMinorErrors => 1);
# rewrite the directory
$newVal = $et->WriteDirectory(\%subdirInfo, $subTable);
# restore our original options
$et->Options(IgnoreMinorErrors => $oldSetting);
} elsif ($$newTags{$tagID}) {
# get new value for this tag if we are writing it
my $format = $$tagInfo{Format} || $$tagInfo{Writable};
my $oldVal = ReadValue($dataPt,$pos+22,$format,1,$size);
my $nvHash = $et->GetNewValueHash($tagInfo);
if ($et->IsOverwriting($nvHash, $oldVal)) {
my $val = $et->GetNewValue($tagInfo);
$newVal = WriteValue($val, $$tagInfo{Writable}) if defined $val;
if (defined $newVal and length $newVal) {
++$$et{CHANGED};
} else {
undef $newVal;
$et->Warn("Can't delete $$tagInfo{Name}");
}
}
}
if (defined $newVal) {
next unless length $newVal; # don't write zero length information
# write the new value
$outBuff .= substr($$dataPt, $pos, 18);
$outBuff .= Set32u(length($newVal) + 4);
$outBuff .= $newVal;
next;
}
}
# rewrite the existing information
$outBuff .= substr($$dataPt, $pos, 22 + $size);
}
unless ($pos == $dirEnd) {
if ($pos == $dirEnd - 4) {
# it seems that sometimes (NX2) the main block size is wrong by 4 bytes
# (did they forget to include the size word?)
$outBuff .= substr($$dataPt, $pos, 4);
} else {
$et->Warn('Nikon Capture Data improperly terminated',1);
return undef;
}
}
# add the header and return the new directory
return substr($$dataPt, $dirStart, 18) .
Set32u(length($outBuff) + 4) .
$outBuff . $pad;
}
#------------------------------------------------------------------------------
# process Nikon Capture data (ref 1)
# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
# Returns: 1 on success
sub ProcessNikonCaptureEditVersions($$$)
{
my ($et, $dirInfo, $tagTablePtr) = @_;
my $dataPt = $$dirInfo{DataPt};
my $dirStart = $$dirInfo{DirStart};
my $dirLen = $$dirInfo{DirLen};
my $dirEnd = $dirStart + $dirLen;
my $verbose = $et->Options('Verbose');
SetByteOrder('II');
return 0 unless $dirLen > 4;
my $num = Get32u($dataPt, $dirStart);
my $pos = $dirStart + 4;
$verbose and $et->VerboseDir('NikonCaptureEditVersions', $num);
while ($num) {
last if $pos + 4 > $dirEnd;
my $len = Get32u($dataPt, $pos);
last if $pos + $len + 4 > $dirEnd;
my %dirInfo = (
DirName => 'NikonCapture',
Parent => 'NikonCaptureEditVersions',
DataPt => $dataPt,
DirStart => $pos + 4,
DirLen => $len,
);
$$et{DOC_NUM} = ++$$et{DOC_COUNT};
$et->ProcessDirectory(\%dirInfo, $tagTablePtr);
--$num;
$pos += $len + 4;
}
delete $$et{DOC_NUM};
return 1;
}
#------------------------------------------------------------------------------
# process Nikon Capture data (ref 1)
# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
# Returns: 1 on success
sub ProcessNikonCapture($$$)
{
my ($et, $dirInfo, $tagTablePtr) = @_;
my $dataPt = $$dirInfo{DataPt};
my $dirStart = $$dirInfo{DirStart};
my $dirLen = $$dirInfo{DirLen};
my $dirEnd = $dirStart + $dirLen;
my $verbose = $et->Options('Verbose');
my $success = 0;
SetByteOrder('II');
$verbose and $et->VerboseDir('NikonCapture', 0, $dirLen);
my $pos;
for ($pos=$dirStart+22; $pos+22<$dirEnd; ) {
my $tagID = Get32u($dataPt, $pos);
my $size = Get32u($dataPt, $pos + 18) - 4;
$pos += 22;
last if $size < 0 or $pos + $size > $dirEnd;
my $tagInfo = $et->GetTagInfo($tagTablePtr, $tagID);
if ($tagInfo or $verbose) {
my ($format, $value);
# (note that Writable will be 0 for Unknown tags)
$tagInfo and $format = ($$tagInfo{Format} || $$tagInfo{Writable});
# generate a reasonable default format type for short values
if (not $format and ($size == 1 or $size == 2 or $size == 4)) {
$format = 'int' . ($size * 8) . 'u';
}
if ($format) {
my $count = 1;
if ($format eq 'string' or $format eq 'undef') {
# patch Nikon bug in size of some values (HistogramXML)
$size += $$tagInfo{AdjustSize} if $tagInfo and $$tagInfo{AdjustSize};
$count = $size;
}
$value = ReadValue($dataPt,$pos,$format,$count,$size);
} elsif ($size == 1) {
$value = substr($$dataPt, $pos, $size);
}
$et->HandleTag($tagTablePtr, $tagID, $value,
DataPt => $dataPt,
DataPos => $$dirInfo{DataPos},
Base => $$dirInfo{Base},
Start => $pos,
Size => $size,
) and $success = 1;
}
$pos += $size;
}
return $success;
}
1; # end
__END__
=head1 NAME
Image::ExifTool::NikonCapture - Read/write Nikon Capture information
=head1 SYNOPSIS
This module is loaded automatically by Image::ExifTool when required.
=head1 DESCRIPTION
This module contains routines to read and write Nikon Capture information in
the maker notes of NEF images.
=head1 AUTHOR
Copyright 2003-2018, 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.cybercom.net/~dcoffin/dcraw/>
=back
=head1 SEE ALSO
L<Image::ExifTool::TagNames/NikonCapture Tags>,
L<Image::ExifTool::TagNames/Nikon Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
|