使用配置的 exiftool 将新标签写入 XMP 组不起作用

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

我需要给很多图片添加新标签,标签是:

AboveGroundAltitude
BandName
CentralWaveLength
ColorTransform
PerspectiveDistortion
PerspectiveFocalLength
PrincipalPoint
WavelengthFWHM

我创建了这个配置文件:


%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' } },
    },
);

变化:我第一次尝试组 0,然后在某处读到 XMP 标签属于组 1 并相应地进行了编辑。

而我 运行 命令是这样的:

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

尝试的变化:

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

另请注意,为清楚起见,此处添加了反斜杠,我的原始命令是一行,没有换行符也没有反斜杠。

我得到的错误是(我在这里尝试混合使用选项来说明不同的错误消息,但是当我尝试它们时,每次尝试都会对选项的样式进行规范化):

此外,使用 -v4 进行更详细的日志记录

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.

请注意 ColorTransform 的消息有何不同

注意:已在此处和 exiftool 论坛中看到 和其他相关帖子。

我找到了相机制造商制作的配置文件,我将其粘贴在下面:

#------------------------------------------------------------------------------
# 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/' },
 );
#------------------------------------------------------------------------------

并以此为模板添加我需要的缺失标签。

Sentera 相机的相关型号信息是:

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

最初的问题是我的员工使用旧固件拍摄了第一批(近 8000 张)航拍照片。后来他更新了固件并完成了剩下的工作。所以在尝试处理图像时,先拍摄的图像会产生错误,处理软件无法运行。

无论如何感谢@StartGeek 的评论:)

很明显,我的尝试与需要的相去甚远,但紧迫感不允许我有时间进一步研究配置 Exiftool 的正确方法。