ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: andreas.zehender on November 26, 2020, 10:42:31 AM

Title: Custom IPTC Record
Post by: andreas.zehender on November 26, 2020, 10:42:31 AM
Hi,

is it possible to specify custom IPTC records via configuration? What's working perfectly is adding custom tags to the IPTC ApplicationRecord 2:xxx, but how can I add an unsupported record? I get Warning = Unrecognized IPTC record 247 (ignored)

I'd like to extend Image::ExifTool::IPTC:Main like this: (from IPTC.pm)

%Image::ExifTool::IPTC::Main = (
   [...]
    240 => {
        Name => 'IPTCFotoStation',
        SubDirectory => {
            TagTable => 'Image::ExifTool::IPTC::FotoStation',
        },
    },
247 => {
        Name => 'IPTCCustomRecord247',
        SubDirectory => {
            TagTable => 'Image::ExifTool::IPTC::IPTCCustomRecord247',
        },
    },

Is this possible via Image::ExifTool::UserDefined?

Best,
Andreas
Title: Re: Custom IPTC Record
Post by: Phil Harvey on November 26, 2020, 10:58:04 AM
Hi Andreas,

See the example config file (https://exiftool.org/config.html) for an example.

- Phil
Title: Re: Custom IPTC Record
Post by: andreas.zehender on November 26, 2020, 11:02:28 AM
Thanks, I know this file.

There is an example how to add an IPTC Tag, but not a whole IPTC Record.

I'd like to add IPTC field 247:200 as custom field.
Title: Re: Custom IPTC Record
Post by: Phil Harvey on November 26, 2020, 11:35:50 AM
Sorry.  I understand now.

This is basically the same as the example for adding a new XMP namespace.  The only trick is the necessary entries in the new table to allow tags to be written.  Here is an example config file to do this:

%Image::ExifTool::UserDefined::IPTCCustomRecord247 = (
    GROUPS => { 0 => 'IPTC', 1 => 'IPTC', 2 => 'Other' },
    WRITE_PROC => \&Image::ExifTool::IPTC::WriteIPTC,
    CHECK_PROC => \&Image::ExifTool::IPTC::CheckIPTC,
    WRITABLE => 1,
    100 => {
        Name => 'MyCustomTag',
        Format => 'string[0,256]',
    },
);

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::IPTC::Main' => {
        247 => {
            Name => 'IPTCCustomRecord247',
            SubDirectory => { TagTable => 'Image::ExifTool::UserDefined::IPTCCustomRecord247' },
        },
    },
);

1; #end


- Phil
Title: Re: Custom IPTC Record
Post by: andreas.zehender on November 27, 2020, 02:31:00 AM
THANKS, that worked.
Best, Andreas