Does exiftool's command-line version allow fetching image filenames containing an xmp:keyword value that matches against a regular expression? If not regular expressions, then at least the * wildcard? Is there a GUI application for Windows suited for this task?
Exiftool is written in Perl so it has excellent regex support. You just need to know enough Perl to use it, which isn't too hard.
You would use the -if option (https://exiftool.org/exiftool_pod.html#if-NUM-EXPR) in this manner to check files, changing the double quotes to single quotes if your using Mac/Linux/Powershell
exiftool -if "$Subject=~/.*search term.*/" -Subject /path/to/files/
If you're looking for an exact match, things can get tricky. The XMP:Subject tag (which is where keywords are stored in XMP) is treated as string in the above command, but it is stored as a list. The the regex match is compared against the full string of keywords, not against individual keywords. To get an exact match of a keyword, you would have to take into account the separation characters (by default, a (comma)(space) unless the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) is used) as well as start/end of line
Exact match
exiftool -if "$Subject=~/(^|, )exact search term(, |$)/" -Subject /path/to/files/
As for a GUI, I'm not sure how many programs have regex support for keywords. It's not something I've check for when testing programs out. The only one I know of is the one I use, which is Imatch by Photools (https://www.photools.com/), which has the best metadata support of anything I've seen.
Quote from: swarup on May 03, 2022, 03:55:18 AM
something's bothering me though. ive been saving keywords under the prism namespace all this time (which is not listed as non-standard btw). but you just told me that subject is the canon tag for the job, possibly you mean the subject tag under dublin code namespace.
Yes. Using just
Subject is enough. Exiftool will write to
XMP-dc:Subject by default. IMO, when writing it's always best to keep the tags names as simple as possible unless you know exactly what you're doing. Just the tag name if possible, then Group 0. Group 1 only if you really need to. For example, writing
Subject to a PDF will write to the Dublin Core tag by default, when you might actually want
XMP-pdf:Subject, which is marked as Avoid. That would be the time to use the full group name. This can especially be problematic when writing to EXIF tags, as it really isn't obvious if something should go in
ExifIFD,
IFD0,
IFD1 (or higher),
SubIFD,
SubIFD1 (or higher), etc.
The complete lists of groups can be found under the
GetAllGroups function (https://exiftool.org/ExifTool.html#GetAllGroups) or by using the
-listg option (https://exiftool.org/exiftool_pod.html#list--listw--listf--listr--listwf--listg-NUM--listd--listx).
Quotejust how important is it to store under a well-known tag? and ive already updated xmp:keyword (prism) to many images; if its necessary, how do i move them from there to xmp:subject?
It depends. If it works for you and the programs you use, then that's great. But if your files need to be shared with someone else or if you ever decide to migrate your files to another program, then you would want to use the more common tags which are part of a standard. The IPTC Photo Metadata Standard (https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata) is the most widely used standard.
To copy from
XMP-prism:Keyword to
XMP-dc:Subject, you would use this command
exiftool "-XMP:Subject<XMP:Keyword" /path/to/files/Quoteoriginally i sought to rely on exif:xpkeywords cuz windows has built-in support for searching xpkeywords
All the XP* tags (
XPKeywords,
XPComment, etc) are really terrible places to put important data, because they only work with Windows. Almost no other program supports them.
But Windows will also read from the more common locations in IPTC IIM and XMP. See this post (https://exiftool.org/forum/index.php?topic=6591.msg32875#msg32875) for a list of what tags Windows will read the the properties that it fills.
Quotebut only for jpegs for whatever reason.
And tiff, but tiff is not as common except in printing, unfortunately. But I'm guessing by this comment, you're referring to PNGs. PNG files have truly terrible support for metadata in most programs. Windows, for example, will read one tag and one tag only from a PNG file. See the above link.
Quotei need to store images in png format cuz every time i send jpegs they get compressed
Heh, should have read all the way through before the above paragraph.
Quotenow i just gotta build a gui that can pass commands to exiftool and open images by filenames returned by exiftool. it might be a difficult job still, but ive a huge head start on that compared to the actual metadata manipulation. yay!
You might want to look around and see what's out there. There are a lot of programs designed for dealing with image collections. For simple editing, there's jExifToolGUI (https://exiftool.org/forum/index.php?topic=11355.0). Adobe Bridge (https://www.adobe.com/products/bridge.html) is free and writes to a large range of common and not so common metadata. After that, you could step up to a full blown Digital Asset Management (DAM) program such as Lightroom, ACDSee, or Imatch (https://www.photools.com/) (all paid) or digiKam (https://www.digikam.org/) or Darktable (https://www.darktable.org/) (both free).
After reading all of this, I get the feeling that you're not using a program that will read/write the
XMP-prism tags. I'd suggest migrating away from them. Copying to
Subject will allow you to search for files in Windows, as Windows will read that tag.