Newbie help needed...please

Started by ssmith001, May 29, 2013, 02:52:52 PM

Previous topic - Next topic

ssmith001

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.

Phil Harvey

You could try this:

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

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ssmith001

Thanks Phil. That worked perfectly.

ssmith001

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.

Phil Harvey

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 for examples.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ssmith001

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"

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ssmith001

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ssmith001

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

Phil Harvey

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 in this case.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ssmith001

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ssmith001

How would I inject a new value into this field if one doesn't exist?

Phil Harvey

exiftool '-GA_RecordID=SOME VALUE' -ext tif /Users/stevesmith/Downloads
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).