Help with command that didn't work in MacOS Ventura

Started by sftoprov, April 06, 2023, 07:57:59 PM

Previous topic - Next topic

sftoprov

I'd like to copy the contents of the IPTC 'description' field into the 'title' field for all photos in a folder.

I tried this from a Terminal window:
exiftool -r -P -m '-Title<Description' -overwrite_original_in_place *

but it didn't seem to do anything except plop me into a command subprompt of "quote>". Any help appreciated.

Phil Harvey

You get that prompt in zsh if the quotes are not closed properly.

But I copied and pasted your command exactly in zsh on MacOS Mojave and it worked without any problems:

Phils-MacBook-Pro% ls *
test.jpg
Phils-MacBook-Pro% exiftool -description -title *
Description                     : a description
Phils-MacBook-Pro% exiftool -r -P -m '-Title<Description' -overwrite_original_in_place *
    1 image files updated
Phils-MacBook-Pro% exiftool -description -title *                                       
Description                     : a description
Title                           : a description

However, I would advise against using "*" as an argument.  Instead, use "." to process all writable files in the current directory.  With "*" you will process files that aren't writable by ExifTool as well as files in subdirectories.

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

sftoprov

Thanks for the reply. Somehow I had an errant single-quote character in there and now have that fixed. But now that the command line is running properly, Exiftool doesn't seem to be finding any values in the 'caption' (description) field to process. For almost all 800 photo files it indicates "No writable tags set from xxxxx.JPG", though many of those files definitely have caption information.

My understanding is that what the Apple Photos app considers a 'caption' is the IPTC 'description' field.  But could there be some sort of discrepancy between the two such that Exiftools can't see my 'caption' field data?

Quote from: Phil Harvey on April 06, 2023, 09:45:59 PMYou get that prompt in zsh if the quotes are not closed properly.

But I copied and pasted your command exactly in zsh on MacOS Mojave and it worked without any problems:

Phils-MacBook-Pro% ls *
test.jpg
Phils-MacBook-Pro% exiftool -description -title *
Description                     : a description
Phils-MacBook-Pro% exiftool -r -P -m '-Title<Description' -overwrite_original_in_place *
    1 image files updated
Phils-MacBook-Pro% exiftool -description -title *                                       
Description                     : a description
Title                           : a description

However, I would advise against using "*" as an argument.  Instead, use "." to process all writable files in the current directory.  With "*" you will process files that aren't writable by ExifTool as well as files in subdirectories.

- Phil

sftoprov

Digging further, I see that if I execute

exiftool -description -title *.JPG

in a folder containing 821 .JPG files of which I'll guess 300 have captions, only one is displayed in the result. I'm not sure what is special about that particular file or that caption so that Exiftool sees the caption.

StarGeek

Use the command in FAQ #3 to see what data the app is actually reading.

For a description, there are several possible tags it could be reading.  There is the EXIF:ImageDescription, which is a bit unlikely as it isn't used very often.  Then there is the IPTC:Caption-Abstract which is IPTC IIM/Legacy.  IPTC is the older standard, but still used.  The newest is the XMP:Description.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

sftoprov

#5
Thanks; your note offered the clues I needed. It turns out that of the several hundred image files with captions viewable by the Preview app in MacOS, the vast majority of them have their captions stored in the Caption-Abstract tag in the [IPTC] group. About a dozen have them in the ImageDescription tag in the [IFD0] group, and only one of them has it in the Description tag of the [XMP-dc] group.

My original command did copy the caption data from the one file that has it in the 'Caption' tag. So am I right that if I want to copy the rest of them into the Title tag, I guess I'd want to do something like this  --

exiftool -r -P -m '-Title<Caption-Abstract' -overwrite_original_in_place .
If ImageDescription is not blank then exiftool -r -P -m '-Title<ImageDescription' -overwrite_original_in_place .

Is there a way to do this check for NOT BLANK? Otherwise I'd overwrite what the previous command did. Or maybe I leave out the option -overwrite_original_in_place?

Phil Harvey

I would suggest this command:

exiftool -r -P -m '-Title<Caption-Abstract' '-Title<ImageDescription' '-Title<Description' -overwrite_original_in_place .

This will write Title from any of these, with arguments later on the command line overriding earlier assignments (ie. Description is preferred if it exists).

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

sftoprov

Many thanks for all the help. I'm all set now. What a wonderful tool; much appreciated.

sftoprov

#8
I see with Exiftool that when you directly add both a caption and a title to a photo with the Photos app on a Mac computer (by clicking the Info button and entering those in the Info dialog), it writes the caption into all three of these caption-related tags:

IFD0:ImageDescription
XMP-dc:Description
IPTC:Caption-Abstract

...and the title into both of these tags:

XMP-dc:Title
IPTC:ObjectName

How can I copy the contents of any one of the caption tags, say XMP-dc:Description, into both title tags--XMP-dc:Title and IPTC:ObjectName. Do I need two separate executions of Exiftool, or can it be done with a single command?


Phil Harvey

You can do this by adding more arguments similar to the command I gave above.

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

StarGeek

Quote from: sftoprov on April 12, 2023, 07:51:18 PMDo I need two separate executions of Exiftool

That would be Common Mistake #4

As Phil says, you just need to add on to the above command.  Just copy/paste a section and change Title into ObjectName.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype