Search code examples
exiftool

Writing new tag to XMP group with configured exiftool doesn't work


I need to add new tags to many images, the tags are:

AboveGroundAltitude
BandName
CentralWaveLength
ColorTransform
PerspectiveDistortion
PerspectiveFocalLength
PrincipalPoint
WavelengthFWHM

I created this configuration file:


%Image::ExifTool::UserDefined = (

  'Image::ExifTool::XMP::xmp' => {
    NewXMPxmpTag => { Groups => { 1 => 'AboveGroundAltitude' } },
    NewXMPxmpTag => { Groups => { 1 => 'BandName' } },
    NewXMPxmpTag => { Groups => { 1 => 'CentralWaveLength' } },
    NewXMPxmpTag => { Groups => { 1 => 'ColorTransform' } },
    NewXMPxmpTag => { Groups => { 1 => 'PerspectiveDistortion' } },
    NewXMPxmpTag => { Groups => { 1 => 'PerspectiveFocalLength' } },
    NewXMPxmpTag => { Groups => { 1 => 'PrincipalPoint' } },
    NewXMPxmpTag => { Groups => { 1 => 'WavelengthFWHM' } },
    },
);

Variations: I've tried group 0 the first time, then read somewhere that XMP tags belong to group 1 and edited accodingly.

And I'm running the command like this:

exiftool -config config.txt -ext jpg \
-AboveGroundAltitude='55.8224668413325'\
-BandName='Red, Garbage, NIR'\
-CentralWaveLength='625, 0, 850'\
-ColorTransform='1.000, 0.000, -0.996, 0.000, 0.000, 0.000, -0.286, 0.000, 4.350'\
-PerspectiveDistortion='-0.093, 0.122, 0.000, 0.000, 0.000'\
-PerspectiveFocalLength='5.4'
-PrincipalPoint='3.100, 2.325'\
-WavelengthFWHM='100, 0, 40' test.jpg

Variations tried:

- -xmp:AboveGroundAltitude='55.8224668413325'
- -XMP-AboveGroundAltitude='55.8224668413325'
- -XMP-xmp:AboveGroundAltitude='55.8224668413325'
- all the three above with `+=` between the tag and the value

Also note the backslashes were added here for clarity, my original command is a one liner with no newlines nor backslashes.

The error I'm getting is (I'm using a mix of options tried here to illustrate different error messages, but when I tried them the style for options were normalized at each try):

Also, used -v4 for more verbose logging

exiftool -config config.txt -v4 -ext jpg -XMP-AboveGroundAltitude='55.8224668413325' -xmp:BandName='Red, Garbage, NIR' -XMP-xmp:CentralWaveLength='625, 0, 850' -xmp:ColorTransform='1.000, 0.000, -0.996, 0.000, 0.000, 0.000, -0.286, 0.000, 4.350' -PerspectiveDistortion='-0.093, 0.122, 0.000, 0.000, 0.000' -xmp:PerspectiveFocalLength='5.4' -xmp:PrincipalPoint='3.100, 2.325' -xmp:WavelengthFWHM='100, 0, 40' test.jpg

Tag 'XMP-AboveGroundAltitude' is not defined or has a bad language code
Warning: Tag 'XMP-AboveGroundAltitude' is not defined or has a bad language code
Tag 'xmp:BandName' is not defined
Warning: Tag 'xmp:BandName' is not defined
Tag 'XMP-xmp:CentralWaveLength' is not defined
Warning: Tag 'XMP-xmp:CentralWaveLength' is not defined

Sorry, xmp:ColorTransform doesn't exist or isn't writable
Warning: Sorry, xmp:ColorTransform doesn't exist or isn't writable

Tag 'PerspectiveDistortion' is not defined
Warning: Tag 'PerspectiveDistortion' is not defined
Tag 'xmp:PerspectiveFocalLength' is not defined
Warning: Tag 'xmp:PerspectiveFocalLength' is not defined
Tag 'xmp:PrincipalPoint' is not defined
Warning: Tag 'xmp:PrincipalPoint' is not defined
Tag 'xmp:WavelengthFWHM' is not defined
Warning: Tag 'xmp:WavelengthFWHM' is not defined
Nothing to do.

Notice how the message for ColorTransform is different

Note: Already seen enter link description here and other related posts here and in the exiftool forum.


Solution

  • I found a configuration file made by the camera maker, which I'll paste below:

    #------------------------------------------------------------------------------
    # File:         xmp_camera_tags.config
    #
    # Description:  Adds capability to modify all XMP camera tags
    #
    #------------------------------------------------------------------------------
    
    %Image::ExifTool::UserDefined = (
        'Image::ExifTool::XMP::Main' => {
            Camera=> {
                SubDirectory => {
                    TagTable => 'Image::ExifTool::UserDefined::Camera',
                },
            },
        },
    );
    %Image::ExifTool::UserDefined::Camera = (
        GROUPS => { 0 => 'XMP', 1 => 'XMP-Camera', 2 => 'Other' },
        NAMESPACE => { 'Camera' => 'http://pix4d.com/Camera/1.0/' },
        WRITABLE => 'string',
        GPSXYAccuracy=> {},
        GPSZAccuracy => {},
        Pitch => {},
        Roll=>{},
        Yaw => {},
        BandName => { List => 'Seq' },
        CentralWavelength => { List => 'Seq' },
        WavelengthFWHM => { List => 'Seq' },
        BandSensitivity => { List => 'Seq' },
        ColorTransform => { List => 'Seq' },
     );
    
    %Image::ExifTool::UserDefined::camera = (
        GROUPS => { 0 => 'XMP', 1 => 'XMP-Camera', 2 => 'Other' },
        NAMESPACE => { 'Camera' => 'http://pix4d.com/Camera/1.0/' },
     );
    #------------------------------------------------------------------------------
    

    and used that as a template to add the missing tags I needed.

    The relevant model info for the Sentera camera is:

    LensModel                       : 5.4mm-0001_0015
    Model                           : 21021-03_12MP-ERS-0001
    

    Original problem was my employee took a first batch (near 8000) of aerial photos with an old firmware. Later he updated the firmware and did the rest of the work. So when trying to process the images, the ones taken first would produce errors and the processing software refused to work.

    Thanks anyway @StartGeek for your comments :)

    Clearly my attempt was far, far away from what was needed, but the urgency didn't allow me time to investigate further the proper way to configure Exiftool.