I like to cut my images' IPTC core Title, Description, Headline characters at to a certain number.
So for example if an image has 300 characters, I would like to cut it at 195 characters to be 195 character long.
It would be great if it would cut it at the nearest word, resulting a title below 195 character
To cut to a specific length, you could use this command:
exiftool -if "length($Title)>195" "-Title<${Title;s/^(.{1,195}).*/$1/s}" /path/to/files/
Cutting on a word, based upon this StackOverflow answer, would be:
exiftool -if "length($Title)>195" "-Title<${Title;s/^(.{1,195}(?!\w)).*/$1/s}" /path/to/files/
This command creates backup files. Add -overwrite_original
to suppress the creation of backup files. Add -r
to recurse into subdirectories. If this command is run under Unix/Mac, reverse any double/single quotes to avoid bash interpretation.