【问题标题】:Writing new tag to XMP group with configured exiftool doesn't work使用配置的 exiftool 将新标签写入 XMP 组不起作用
【发布时间】:2020-02-17 22:43:43
【问题描述】:

我需要为许多图像添加新标签,标签是:

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 论坛中看到 enter link description here 和其他相关帖子。

【问题讨论】:

  • 我不能帮助太多 atm,但你的配置文件是倒退的。你被定义了相同的标签名称,NewXMPxmpTag,一遍又一遍。您使用标签名称作为组名。有关组的定义,请参阅 exiftool GetGroup perl command。您需要仔细查看example.config file。您可以做的最简单的事情是使用 AboveGroundAltitude => { }, 将标签创建为字符串(续)
  • 但是由于该标签是一个数字,您可以使用AboveGroundAltitude => { Writable => 'rational' }, 更好地定义它。您应该前往ExifTool forums,作者可以为您提供更好的提示。
  • 附加问题,这些标签是您为自己的目的而创建的吗?或者这些标签是否已经嵌入到您的某些文件中并且您正在尝试复制它们并创建它们的定义?如果是后者,那么您必须以非常特定的方式制作标签。需要使用 exiftool -XMP -B File.jpg 显示原始 XMP 以查看这些标签的 XMP 是如何形成的。
  • 我使用了你链接的example.config,因为论坛上的每个人都链接了类似的问题。我从第 107 行开始遵循示例 5。由于 cmets 不够自我解释,我假设“作者”部分是定义我的标签名称的部分,NewXMPxmpTag 是定义新标签的命令。最后,我从相机制造商那里找到了一个现成的配置,并用它来设计我需要的配置。我现在就发布解决方案

标签: exiftool


【解决方案1】:

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

#------------------------------------------------------------------------------
# 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 为您提供的 cmets :)

显然,我的尝试与需要的东西相去甚远,但紧迫性没有让我有时间进一步研究配置 Exiftool 的正确方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多