Author Topic: Write to custom XMP field  (Read 1939 times)

murphysm2342

  • Jr. Member
  • **
  • Posts: 13
Write to custom XMP field
« on: January 26, 2017, 01:41:42 PM »
So sorry about asking this but I've only been coding anything for the last few weeks and so I'm so confused on how to write to custom XMP fields with the .config file.  I've read through the example.config page, reviewed some other user forum posts and am still totally confused on how it should be written/how it should work.

Here is my custom XMP panel for use with our studio's images via Photoshop:
Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<xmp_definitions>
<xmp_schema namespace="http://my.custom.namespace/" prefix="custom" label="$$$/Custom/Schema/Label=Shopbop Custom Properties" description="$$$/Custom/Schema/Description=This example panel contains most of the options available for the &apos;Generic Panel&apos;.">
<xmp_property category="external" name="PhotoShootName" type="text" label="$$$/Custom/Property/PhotoShootName=Photo Shoot Name:" />
<xmp_property category="external" name="OnModel" type="text" label="$$$/Custom/Property/OnModel=On Model:" />
<xmp_property category="external" name="ModelName" type="text" label="$$$/Custom/Property/ModelName=Model Name:" />
<xmp_property category="external" name="PhotographerName" type="text" label="$$$/Custom/Property/PhotographerName=Photographer Name:" />
<xmp_property category="external" name="TimeOfDay" type="text" label="$$$/Custom/Property/TimeOfDay=Time of Day:" />
<xmp_property category="external" name="BayNumber" type="text" label="$$$/Custom/Property/BayNumber=Bay Number:" />
<xmp_property category="external" name="BusinessUnit" type="text" label="$$$/Custom/Property/BusinessUnit=Business Unit:" />
<xmp_property category="external" name="SunglassOpacity" type="text" label="$$$/Custom/Property/SunglassOpacity=Sunglass Opacity Level (1, 2 or 3):" />
</xmp_schema>
</xmp_definitions>

and the config file I've hodge-podged together:
Code: [Select]
%Image::ExifTool::UserDefined::ShopbopCustomData = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-custom', 2 => 'Image' },
    NAMESPACE     => { 'custom' => 'http://my.custom.namespace/' },
    WRITABLE      => 'string',
    PhotoShootName => { },
    OnModel => { },
    ModelName => { },
    PhotographerName => { },
    TimeOfDay => { },
    BayNumber => { },
    BusinessUnit => { },
    SunglassOpacity => { },
);

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        custom => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::custom',
            },
        },
    },
);

#------------------------------------------------------------------------------
1;  #end

I've tried testing it with the following command:
Code: [Select]
exiftool -config /Users/seanmurp/Desktop/Shopbop_Custom_Data.config /Users/seanmurp/Desktop/Output/APCAA3090070175_02.jpg -BayNumber=1
With the result of: Warning: Tag 'BayNumber' is not defined.  Nothing to do.

Perhaps I've got things totally wrong all around, but I'm so not understanding this process.  Thanks for helping a newb!
SMM

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: Write to custom XMP field
« Reply #1 on: January 26, 2017, 01:53:49 PM »
Your only problem is that you have named your table "Image::ExifTool::UserDefined::ShopbopCustomData" but referred to a table of a different name:

Code: [Select]
                TagTable => 'Image::ExifTool::UserDefined::custom',
- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

murphysm2342

  • Jr. Member
  • **
  • Posts: 13
Re: Write to custom XMP field
« Reply #2 on: January 26, 2017, 02:07:12 PM »
Wow.  That's about all I can say.  Thank you very much. 

p.s. I love your tool!