Hey!
This is a BBEdit-question, but I first need to give a little background to it. :-)
As all photographers here already know, the metadata to the photos lives in a suplimentary XMP-file.
Here is a sample of a XMP-file for one of my photos, where I filled in the so called IPTC-keywords in Photo Mechanic:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.6.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:photomechanic="http://ns.camerabits.com/photomechanic/1.0/"
photoshop:DateCreated="2018-05-10T13:35:00.03"
xmp:CreateDate="2018-05-10T13:35:00.03"
xmp:Rating="0"
photomechanic:ColorClass="0"
photomechanic:Tagged="False"
photomechanic:Prefs="0:0:0:-00001"
photomechanic:PMVersion="PM6">
<dc:subject>
<rdf:Bag>
<rdf:li>Ben</rdf:li>
<rdf:li>Mina</rdf:li>
<rdf:li>Tom</rdf:li>
<rdf:li>Vlad</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
The individual data is the creation-date:
photoshop:DateCreated="2018-05-10T13:35:00.03"
xmp:CreateDate="2018-05-10T13:35:00.03"
and the IPTC-keywords:
<rdf:li>Ben</rdf:li>
<rdf:li>Mina</rdf:li>
<rdf:li>Tom</rdf:li>
<rdf:li>Vlad</rdf:li>
Another background-information that probably all of you know: there is no relation between the IPTC / XMP - keywords and the Finder / macOS - tags.
And this exactly is my problem.
I need to input somehow / somewhere the metadata to my photos, but I don't want to make this twice in order to have this information present in the IPTC-keywords AND in the Finder-tags as well.
This is not new at all: Google-ing about "copy IPTC-keywords into Finder-tags" or viceversa I've found a lot but all of it involved in one step or another the EXIFtool, a command line utility that reads and writes photo-metadata… and this doesn't scale very well (I have A LOT of photos: about 220,000 pics that are more than 2 TB big!) and it is slow, because the EXIFtool have to read the metadata from the photo.
So my idea is to take care or the IPTC-keywords in Photo Mechanic (this would create a XMP-file as the one above for every photo I have) and then - and here comes BBEdit! :-) - somehow transfer the data from the XMP-file (that is in the end only a text-file!) to the Finder-tags.
Now finally to my question (sorry for the length!): How could I
for every photo in a folder?
Ideally I'd have a script, point it to a folder full of photos and BOOM!, after this every photo would have the same Finder-tags as the IPTC-keywords!
Could you please help me with this?
Thanks in advance!
Regards,
Vlad
I was inexact regarding file-names and -number:
So for a given photo „PhotoName“ I have always at least two files
PhotoName.CR2 (the RAW-file)
PhotoName.XMP (the metadata-file, I was hard-working enough to take care of the metadata ;-)
and for the most of the photos there are even some other edited versions as
PhotoName.JPG
PhotoName-1.JPG
PhotoName-bw.JPG
PhotoName.TIFF
The edited versions all begin with A but can have a) some data added to the end of the file-name (as digits for various versions or -bw for black & white) and b) some other file-extensions (JPG and once in while TIFF).
That make my dream-script a little more complicated:
I hope that now is more clearer.
Thanks in advance!
Regards,
Vlad
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: https://twitter.com/bbedit
--- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/93FE2214-4BDD-4C41-952F-61C910E44C38%40Ghitulescu.de.
Maarten,
thanks for your quick reply!
I mentioned grep because I'd like to search for the keywords that are recognizable due to the rfd:li - tags in the XMP-file AND also because this is something I suppose it's easy to do with grep in BBEdit (even if it's still out of my reach :-)… as well as the rest of my wish-script :-/).
Thanks again!
Regards,
Vlad
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/34388495-D44C-4AB9-8537-55E936C4CC31%40xs4all.nl.
Hey!
What I've got so far:
I manage to extract the IPTC-keywords from the initial example:
using BBEdit's "Process Line Containing…"-command, where I searched for
<rdf:li>
first
<rdf:li>
and then
</rdf:li>
with nothing.
The result:
Ben
Mina
Tom
Vlad
are the 4 IPTC-Keywords that I want to set as Finder-tags to the CR2 / JPG / TIFF - file with the same name as the XMP-file.

These are only a couple of pieces of the whole puzzle and right now I don't have a clue how to "glue" them together :-(
Any help would be greatly appreciated.
Regards,
Vlad
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/E3AD63CE-D6D0-4FD0-A317-514C772BFBC9%40Ghitulescu.de.
Jean-Christophe,
thanks a lot for your reply!
Google-ing (see my first email) I've found already the very same AppleScript from Shane Stanley back in 2002 (!) - so yes, that's another puzzle piece! Hurray! :-)
I'm still missing a lot:
I don't know how to peek the first XMP-file in the chosen folder and then apply the magic of extracting the IPTC-keywords of it. This is what I've manually done with BBEdit, but I don’t know how to put it in an AppleScript / RegEx :-(
How do I pipe the result from point 1 to Shane Stanley's AppleScript? (*)
And how do I tell to the above AppleScript to which CR2 / JPG / TIFF - file (with the same name as the XMP-file from point 1 above) to apply the tags (= IPTC-keywords) extracted from the XMP-file in point 1 above?!
And finally: How do I loop to the next XMP-file within the chosen folder?
It feels like I have less than I'm missing right now! :-D
At least the points 1, 2 and 4 seem trivial… I'll google them.
Thanks again, Jean-Christophe!
Regards,
Vlad
(*): I've found a hint from Dr. Drang in an AppleScript called from KeyboardMaestro to tag a file. What I like about it is that it uses a list of tags… that could be the result of my point 1 above! :-) Ok, I still don't know how to pipe it to Keyboard Maestro, so I'm still on square (= point ;-) 1! :-(
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/85ED17EA-5E51-4CA7-AD1E-B1C557942702%40traduction-libre.org.
I've found here on StackOverflow how to:
Here's the modified part of the AppleScript:
-- we can check the file extensions of a file against this list to evaluate if it's a XMP file
set xmp_ext_list to {"xmp"}
-- get the folder to check
set f to choose folder
-- notice the use of "entire contents" to also go through subfolders of f
-- use a "whose" filter to find only the video files
tell application "Finder"
set xmpFiles to (files of entire contents of f whose name extension is in xmp_ext_list) as alias list
end tell
I'm still searching for the missing pieces… :-)
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/AB4D6C1B-1E4B-48D1-B451-F14B9850FA12%40Ghitulescu.de.
Hey!
This is a BBEdit-question, but I first need to give a little background to it. :-)
[snip]
This is not new at all: Google-ing about "copy IPTC-keywords into Finder-tags" or viceversa I've found a lot but all of it involved in one step or another the EXIFtool, a command line utility that reads and writes photo-metadata… and this doesn't scale very well (I have A LOT of photos: about 220,000 pics that are more than 2 TB big!) and it is slow, because the EXIFtool have to read the metadata from the photo.
[snip]
I run the little piece of AppleScript below supplemented with a loop within the xmpFiles (only to see that I'm able to loop… now at least you see that I don't know exactly what I'm doing! ;-):
-- we can check the file extensions of a file against this list to evaluate if it's a XMP file
set xmp_ext_list to {"xmp"}
-- get the folder to check
set photoFolder to choose folder
-- notice the use of "entire contents" to also go through subfolders of photoFolder
-- use a "whose" filter to find only the XMP files
tell application "Finder"
set xmpFiles to (files of entire contents of photoFolder whose name extension is in xmp_ext_list) as alias list
end tell
set filePaths to {}
repeat with currentXMPfile in xmpFiles
set end of filePaths to {POSIX path of currentXMPfile}
end repeat
on a folder containing two subfolders with a total of 237 RAW (= CR2)-files and (only) 25 XMP-files and it took about 15 seconds (!) to finish.
I don't have any empirical values to compare with but: Is it not a little slow for only
?!
Could it be that AppleScript is not the perfect tool at least for this part?!
Regards,
Vlad
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/917DCE2C-6D28-4679-A1AE-5D8E54C453F8%40Ghitulescu.de.
GP, thanks for your detailled email.
No, I didn't knew that the EXIFtool parse the XMP file data.
(Now that you said this it seems obvious to me too - I thought initially that the EXIFtool will somehow read the photo-file, but that's nonsense, since the IPTC-data is in the XMP-file ant not in the RAW / JPG / TIFF - file itself).
Your 4-steps "formula" sounds much more valid than my dream script.
I understand on the high level what you're describing here but unfortunately I have no clue how to implement it since I haven't had the chance to dig into perl yet.
Let me clarify the only manual step that I still see in the whole process: I'll have to set the IPTC-metadata (at least the basic one like caption, keywords, author, copyright etc.) for each and every photo-file (CR2, JPG, TIFF).
Only after this "manual labor" :-) I'd like to choose either the root-folder of all my photo-subfolders or - if this will be too slow - each photo-subfolder and let the script automatically copy the IPTC-keywords of each photo-file (from the XMP-file, via EXIFtool) into its Finder-tags.
As I said initially, I thought about BBEdit first because BBEdit Talk is filled with GREP / regex - questions and it seem like a piece of cake (iterate over a series of text-files, parse the IPTC-keywords and pipe them into something that tag the photo-file with it… easy, right?! ;-)
If my question is actually inappropriate here or better suited elsewhere I'm sorry and totally grateful for each and every hint, because: I still have this HUGE PILE of photos to tag! ;-) :-(
Thanks again, GP!
Regards,
Vlad
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/3784e93c-9613-46b4-af8e-b50ab9deee1c%40googlegroups.com.
Scott,
Thank you for your reply!
First the very short answers:
Now with more details: Just last week I finished exporting my masters and their edited copies from Aperture.
Aperture had a "proper cataloging" and it managed exceptionally IPTC- and EXIF-metadata. But Apple abandoned Aperture many years ago (and Aperture cannot run under Catalina - that's the single reason I'm still on Mojave right now) and here I am with all my painfully completed Aperture-keywords lost!
So I decided to never use a proprietary system for search & find photos again.
Meanwhile the XMP-files are the standard to go, so I tested last week:
In the end I've got Photo Mechanic (it's by far the fastest when culling and can assign metadata on import) and I'm still testing Neo Finder.
But not a single DAM software I tested is able to copy the IPTC-keywords into Finder-tags - and I asked directly NeoFinder's Norbert Dörner and talked with Photo Mechanic's support about it as well.
This is what I try to solve with a script - in order to be able to filter (within a DAM AND / OR in the Finder or anything else that uses Spotlight, like HoudahSpot, what I very much prefer) my photos by the Finder-tags.
I'm probably safe enough using only IPTC-metadata now but I'm still slightly traumatized ;-) after the Aperture-episode and I would like to have the Finder-tags assigned to my photos as well, if it's possible.
Sorry for the long answer & thanks again!
Regards,
Vlad
On 14 Mar 2020, at 21:29, Scott in Pollock wrote:
Vlad,While I am sure this is doable in AppleScript and or Automator, my initial tests here show it will be slow as all get out (filtering folder contents on file extension, and setting finder labels, reiteratively).
Why not just get a proper cataloging tool like [url=https://www.cdfinder.de/en/downloads.html]NeoFinder[/url], that will automatically read the xmp files into its database, create thumbnails from your images, and provide search and smart collections based on all of your metadata both exif and xmp, with full editing ability, and do it super fast. It is what I use and I couldn't be happier with it.
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/dfba241e-f8cd-4648-9f05-8c7d021af8a2%40googlegroups.com.
Hi, Scott!
Yes, it looks like I'm out of luck! ;-)
Thanks anyway!
Regards,
Vlad
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/6844457c-5531-4a38-a37b-37c5cc7d9a94%40googlegroups.com.
Hi, Jeffrey!
Thanks for your reply!
I’m aware that this reply is entirely NOT related to BBEdit so I’ll keep it short - let’s talk private about this.
On 15 Mar 2020, at 20:38, 'Jeffrey Jones' via BBEdit Talk wrote:
The IPTC data is accessible in Spotlight.
I couldn't get to any IPTC-metadata through Spotlight:

No XMP-metadata:

Only 2 EXIF-attributes:

The above screenshots are from a Finder-search-window, but I get the same within HoudahSpot that uses the Spotlight-index as well.
In Automator I have only one action regarding IPTC (set IPTC-attributes) from Aperture (still on my system).
Regards,
Vlad