append base file name to labels

Started by rparmar, June 23, 2011, 09:53:22 PM

Previous topic - Next topic

rparmar

I am new to this tool and my command-line days lie behind me. I simply want the image file name added to the list of keywords in the meta data. Neither of the following seem to work, giving me the warning "Warning: [minor] Error reading value for ImageProcessingIFD entry 146"

exiftool" "-exif:XPKeywords+<%f" E6231668.orf
exiftool" "-keywords+<%f" E6231668.orf

The keywords I hope I am changing are those as reflected in the Keyword List hierarchy in Lightroom. Maybe I am totally in the wrong place.

rparmar

#1
P.S. I see now that the very next thread is a variation on the same question. I guess I should have refreshed my browser since landing here!

PH Edit: Added link to the other thread

concord977

I'm a newbie, but I had some success using the following command:

exiftool "-IPTC:keywords<filename" E6231668.orf

However, it replicated the same effect I reported in the other thread ... that the file extension carried over.

Phil Harvey

This is what you want:

exiftool "-iptc:keywords+<filename" ...

or use MWG:Keywords instead of IPTC:Keywords for better compatibility (see the MWG tag name documentation for details).

- 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 ($).

rparmar

OK, so I tried that and it said the MWG keyword was not supported. Using iptc:keywords it was still not touching the file.

I converted the proprietary ORF image files I was using to standard DNG. This is better for all sorts of reasons, not least of which I can have more faith in their standard.

I decided to reinstall exiftool since my copy might be out of date. I downloaded the executable but it does not unpack, giving this error (Where USER is my user name):
Error running more C:\Users\USER\AppData\Local\Temp\par-USER\\exiftool_doc.txt

OK, so back to the version I have, which is a bare-bones naked EXE. I figured maybe I need the configuration file in place, so I copied the text of what I could find on your website to a file called config.cfg, put this in the exiftools folder and ran this command line:
"PATH\exiftool" -config "PATH\config.cfg" "-iptc:keywords+<filename" E6231667.dng

Here is the output:
Warning: Bad ImageProcessingIFD offset for tag 0x1104 - E6231667.dng
Warning: Error rebuilding maker notes (may be corrupt) - E6231667.dng
No XMP HASH(0x2de8e0c) structure!
Warning: [minor] Ignored empty rdf:Alt list for dc:description - E6231667.dng
Error: [minor] Bad ImageProcessingIFD offset for tag 0x1104 - E6231667.dng
    0 image files updated
    1 files weren't updated due to errors


The file does indeed have pre-existing keywords. I can see these in Lightroom and GeoSetter, which uses exiftool under the hood. That app can set keywords without a problem once I manually enter the file name.

At this point I am stumped again.

Phil Harvey

Quote from: rparmar on June 24, 2011, 09:21:18 AM
OK, so I tried that and it said the MWG keyword was not supported.

Please update to a more recent version of ExifTool.  The MWG feature was added almost 2 years ago in version 7.98.

QuoteI downloaded the executable but it does not unpack, giving this error (Where USER is my user name):
Error running more C:\Users\USER\AppData\Local\Temp\par-USER\\exiftool_doc.txt

Please try re-downloading and re-installing after erasing the files in your C:\Users\USER\AppData\Local\Temp\par-USER directory.

- 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 ($).

rparmar

I did that but the installer gives the same error. The double backslash seems to be a syntax problem, no?

Phil Harvey

The double backslash may explain why it can't load the help file (but I don't understand it), but what is the error when you try to actually do something?

Does it create the "C:\Users\USER\AppData\Local\Temp\par-USER\exiftool-8.59" directory as it should?

- 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 ($).

rparmar

It creates C:\Users\USER\AppData\Local\Temp\par-USER\cache-exiftool-8.59\ with the extra cache- in there. Inside is an executable exiftool(-k).exe but it won't run from the command line with that name. There are also 8 dll files and a whole bunch of pm files. Also an inc folder with many hundreds of folders and files. Is this as it should be?

Phil Harvey

Quote from: rparmar on June 24, 2011, 01:20:32 PM
It creates C:\Users\USER\AppData\Local\Temp\par-USER\cache-exiftool-8.59\ with the extra cache- in there.

Right, good.   I forgot about the extra "cache-".  I just wanted to verify that exiftool had the ability to write files in the temporary directory.

QuoteInside is an executable exiftool(-k).exe but it won't run from the command line with that name. There are also 8 dll files and a whole bunch of pm files. Also an inc folder with many hundreds of folders and files. Is this as it should be?

This sounds correct.  So what is the error if you run it on an image?  (not run from the temporary files, but from the executable file you downloaded)

- 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 ($).

rparmar

OK, ignoring the cache and simply running the exe as downloaded I used this command line:
"D:\downloads\exiftool-8.59\exiftool(-k)" "-MWG:Keywords+<filename" E6231667.dng

This is the output:
Warning: Bad ImageProcessingIFD offset for tag 0x1104 - E6231667.dng
Warning: [minor] Ignored empty rdf:Alt list for dc:description - E6231667.dng
Error: [minor] Bad ImageProcessingIFD offset for Olympus_ImageProcessing_0x1104
- E6231667.dng
    0 image files updated
    1 files weren't updated due to errors


P.S. thanks for all your help!

Phil Harvey

OK, now we're getting somewhere.

Use the -m option to ignore the minor errors and allow the image to be written.

- 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 ($).

rparmar

OK, that works!  :)

(Except I should be using basename not filename. And it still displays the two Warnings.)

Lightroom does not show the results immediately, but when I "read metadata from file" it updates its database and hence the display. From now on I'll be doing this as a batch before importing, so that won't be an issue.