http://forum.celestialmatters.org/

Anyone an IPTC expert?
http://forum.celestialmatters.org/viewtopic.php?f=2&t=923
Page 1 of 1

Author:  chuft-captain [ Wed, 06-12-17, 7:47 GMT ]
Post subject:  Anyone an IPTC expert?

Anyone know how to batch edit IPTC metadata replacing all occurrences of a substring in a particular metadata field with another substring?
I have a folder of images whose metadata I want to edit on a selective pattern-matching basis.

eg. I might want to search for every occurrence of the string "Fred" in the Caption field, replacing it with "Jane".

So images with the following captions would be transformed like so:
Image 1: "This is Fred's dog" -> "This is Jane's dog"
Image 2: "This is Fred's cat" -> "This is Jane's cat"
Image 3: "This is Mary's dog" -> "This is Mary's dog"
Image 4: "This is Fred" -> "This is Jane"

Irfanview allows bulk changes to IPTC info, but is limited to "replacing" the entire field content, rather than a sub-string:
Attachment:
IrfanviewThumbsIPTC.jpg
IrfanviewThumbsIPTC.jpg [ 84.33 KiB | Viewed 2506 times ]


ie.
You can enter a new caption:
"This is Jane's dog",
but every selected image's caption would be overwritten with that string:
Image 1: "This is Fred's dog" -> "This is Jane's dog"
Image 2: "This is Fred's cat" -> "This is Jane's dog"
Image 3: "This is Mary's dog" -> "This is Jane's dog"
Image 4: "This is Fred" -> "This is Jane's dog"


Not exactly what I had in mind.

CC

Author:  Selden [ Wed, 06-12-17, 9:42 GMT ]
Post subject:  Re: Anyone an IPTC expert?

I know that many different IPTC editors are available, but I have no experience with any of them. See https://en.wikipedia.org/wiki/Compariso ... ta_editors

ExifTool looks like it might do what you want. See http://owl.phy.queensu.ca/~phil/exiftool/
Although it's a command-line utility, several different GUIs are available for it.

Author:  chuft-captain [ Wed, 06-12-17, 14:05 GMT ]
Post subject:  Re: Anyone an IPTC expert?

Thanks Selden,

(I'm quite comfortable with command-line.)

I've heard of ExifTool, but never used it. I think it has the reputation of being the "Mother of all EXIF tools", so if it can't be done in ExifTool I'd be very surprised. As this is just a one-off task I was hoping that I wouldn't have to learn yet another tool's syntax and methodology just for this one job, but it looks like I might just have to bite-the-bullet.

Essentially, I've got a lot of celURL's stored in the metadata of associated images, but as you know, each time you capture a celURL, it stores certain attributes of the celURL such as render-flags and label-flags as whatever they are set to at the time of capture, so you end up with a load of celURL's with various different flag settings.

So the idea is to apply consistent &rf and &lf settings across all these celURL's, so that my render settings are not constantly changing every time I click on a different celURL.

If I could edit them in Notepad++, I'd just use a very simple bit of regex, something like:
Code:
replace: &rf=[0-9]+
with: &rf=54167

and it would be done, and likewise for labelflags.
As good as Notepad++ is, sadly it does not edit IPTC data in images. (AFAIK :mrgreen: )

So, I think my options are:
1. Use EXIFTools to export IPTC data to some NP+ editable format, make the changes in NP+, then import the changed data back into the images with EXIFTools.
or:
2. Do the regex substitutions directly using EXIFTools, which would negate the need for any fluffing around with exporting and importing.

I'm almost certain that EXIFTools will handle both approaches (option 2 being the preferred approach)... just a matter of getting my head around it's syntax and huge set of features.

Thanks for the recommendation...

CC

PS. A quick google for "ExifTool regex" is showing some promising leads.... :D

Author:  chuft-captain [ Sun, 10-12-17, 2:28 GMT ]
Post subject:  Re: Anyone an IPTC expert?

Code:
exiftool.exe -P -overwrite_original -m -api "Filter=s/&rf=\d*/&rf=%num1%/;s/&lm=\d*/&lm=%num2%/" -tagsfromfile @ -iptc:SpecialInstructions %filespec%

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/