ExifTool Forum

ExifTool => Newbies => Topic started by: ssmith001 on May 29, 2013, 02:52:52 PM

Title: Newbie help needed...please
Post by: ssmith001 on May 29, 2013, 02:52:52 PM
Can someone help this newbie? I am looking for an Exif command I can run from the command line, that will look in a particular directory, and for every .eps file in this directory, write (append) the filename into the XMP Keywords field. Can anyone of you experts lend me a hand?

Thanks in advance.
Title: Re: Newbie help needed...please
Post by: Phil Harvey on May 29, 2013, 02:56:25 PM
You could try this:

exiftool "-xmp:subject+<filename" -ext eps SOME_DIRECTORY_NAME

- Phil
Title: Re: Newbie help needed...please
Post by: ssmith001 on May 29, 2013, 03:06:56 PM
Thanks Phil. That worked perfectly.
Title: Re: Newbie help needed...please
Post by: ssmith001 on May 30, 2013, 01:41:49 PM
Phil, one more question. Can this same command be used to perhaps alter other custom XMP fields that we've created in our DAM system? I've attached a screenshot of the fields.
Title: Re: Newbie help needed...please
Post by: Phil Harvey on May 31, 2013, 07:22:55 AM
Yes, but you need to define a corresponding user-defined tag to be able to write your custom XMP field.  See the sample config file (http://www.exiftool.org/config.html) for examples.

- Phil
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 23, 2013, 03:58:40 PM
Phil,

I'm finally getting back to attempting to figure out how to make the changes to the config file (per your example), but I can't seem to figure out how or where to make the changes to this file. I think it may be in this section shown here, but I'm not certain:

# XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::xmp' => {
        NewXMPxmpTag => { Groups => { 2 => 'Author' } },
        # add more user-defined XMP-xmp tags here...
    },

The XMP field I'm attempting to put data into is called "GA_RecordID"
Title: Re: Newbie help needed...please
Post by: Phil Harvey on August 24, 2013, 06:56:41 AM
If you want to create a custom namespace for your new tags, then search for "xxx" in the sample config file and replace this with your custom namespace prefix.  Then add your tags to what was the Image::ExifTool::UserDefined::xxx table.

If you want to add a custom tag to the standard 'xmp' namespace (unusual), you would add it where you indicated.

- Phil
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 26, 2013, 09:08:07 AM
Phil, I'm still not able to get this to work. Here's my config file:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::xwnv' => {
        GA_RecordID => { },
    },
);
1; # end

And here's what I get when I try to update the metadata:


exiftool '-xwnv:GA_RecordID<${xwnv:GA_RecordID} 1234567' -ext tif /Users/stevesmith/Downloads
Warning: [minor] Tag 'xwnv:GA_RecordID' not defined - /Users/stevesmith/Downloads/00331490258_4005973.tif
Warning: No writable tags set from /Users/stevesmith/Downloads/00331490258_4005973.tif
    1 directories scanned
    0 image files updated
    1 image files unchanged
Title: Re: Newbie help needed...please
Post by: Phil Harvey on August 26, 2013, 10:26:39 AM
Not quite.  If you replace the 'xxx' in the config file with 'xwnv', and add your GA_RecordID tag, you get this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        xwnv => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xwnv',
            },
        },
    },
);
%Image::ExifTool::UserDefined::xwnv = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-xwnv', 2 => 'Image' },
    NAMESPACE     => { 'xwnv' => 'http://ns.myname.com/xwnv/1.0/' },
    WRITABLE      => 'string',
    GA_RecordID => { },
);
1; # end


But you need to fill in the actual xwnv namespace with the correct URI.  Check the existing XMP to see what it is:

exiftool -xmp -b /Users/stevesmith/Downloads/00331490258_4005973.tif

- Phil
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 26, 2013, 10:47:51 AM
Phil, I truly appreciate your patience with me...

I've changed the config file as such:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        xwnv => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xwnv',
            },
        },
    },
);
%Image::ExifTool::UserDefined::xwnv = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-xwnv', 2 => 'Image' },
    NAMESPACE     => { 'xwnv' => 'http://ns.xinet.com/ns/xinetschema#' },
    WRITABLE      => 'string',
    GA_RecordID => { },
);
1; # end


And I'm unsuccessful writing to that field:

exiftool '-xwnv:GA_RecordID<${xwnv:GA_RecordID} 1234567' -ext tif /Users/stevesmith/Downloads
Warning: [minor] Tag 'xwnv:GA_RecordID' not defined - /Users/stevesmith/Downloads/00331490258_4005973.tif
Warning: No writable tags set from /Users/stevesmith/Downloads/00331490258_4005973.tif
    1 directories scanned
    0 image files updated
    1 image files unchanged
Title: Re: Newbie help needed...please
Post by: Phil Harvey on August 26, 2013, 11:07:18 AM
I should have paid more attention to your command.  It should be:

exiftool '-XMP-xwnv:GA_RecordID<${XMP-xwnv:GA_RecordID} 1234567' -ext tif /Users/stevesmith/Downloads

or, more simply:

exiftool '-GA_RecordID<$GA_RecordID 1234567' -ext tif /Users/stevesmith/Downloads

If you still get the same error, then the problem is that the config file isn't loaded.  See FAQ number 11 (https://exiftool.org/faq.html#Q11) in this case.

- Phil
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 26, 2013, 11:14:43 AM
I added the line to see if the config is loading, and it would appear that it is:

exiftool '-GA_RecordID<$GA_RecordID 1234567' -ext tif /Users/stevesmith/Downloads
LOADED!
Warning: [minor] Tag 'GA_RecordID' not defined - /Users/stevesmith/Downloads/00331490258_4005973.tif
Warning: No writable tags set from /Users/stevesmith/Downloads/00331490258_4005973.tif
    1 directories scanned
    0 image files updated
    1 image files unchanged
Title: Re: Newbie help needed...please
Post by: Phil Harvey on August 26, 2013, 11:20:20 AM
Oh, right.  You'll also get this message if the file doesn't already contain the tag (since you are trying to add a number to its value).  Make sure you start with a file that contains this tag.

So many details to get right...

- Phil
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 26, 2013, 11:23:18 AM
How would I inject a new value into this field if one doesn't exist?
Title: Re: Newbie help needed...please
Post by: Phil Harvey on August 26, 2013, 11:27:13 AM
exiftool '-GA_RecordID=SOME VALUE' -ext tif /Users/stevesmith/Downloads
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 26, 2013, 11:34:56 AM
That worked. Thanks a ton!

Now, if I wanted to update the GA_RecordID field with the last 7 digits of the filename (before the .tif extension), is this the correct syntax? I did run this but it didn't update the field.

exiftool '-GA_RecordID+<${filename;$_=substr($_,-11,7)}' -ext tif /Users/stevesmith/Downloads
Title: Re: Newbie help needed...please
Post by: ssmith001 on August 26, 2013, 11:38:39 AM
Never mind, I figured it out. Thanks again for you superior assistance. You rock!