Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Search / filter images by custom metadata field

Community Beginner ,
Nov 30, 2023 Nov 30, 2023

Hi,

 

I need to find and/or filter files (especially images) by metadata stored in custom field. This particular metadata can be seen in file info, and it can be also found when search is done to all metadata fields. However, this doesn't help me since I would need to focus the search in the mentioned custom field.

 

Is there some way to work with this matter?

TOPICS
Metadata , Scripting
943
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Nov 30, 2023 Nov 30, 2023

@Sami33901227vjt3 

 

You can use the Bridge script "Expert Search" from Paul Riggott to create a collection from the specific search criteria:

 

https://github.com/Paul-Riggott/PS-Scripts/blob/master/Expert%20Search.jsx

 

2023-12-01_12-21-14.pngexpand image

Translate
Community Expert , Nov 30, 2023 Nov 30, 2023

@Sami33901227vjt3 

 

The following ExifTool code will conditionally move the matching files to a new folder named 'Hiekkalaatikko':

 

exiftool -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -directory=%d'Hiekkalaatikko' '/Users/jill/Desktop/My Folder/'

 

Keep in mind that this is simply processing the top-level of the target folder. You can add the -r or -recurse flag/argument to drill into nested sub-directories.

 

Translate
Community Expert ,
Nov 30, 2023 Nov 30, 2023

Can you attach a copy of the file with embedded custom metadata? You can crop the file to a small size as it's only the metadata that's important. Please note which is the custom field and if the value is static or variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

For sure,

 

The custom field that i'm looking for is:

<skyview:CustomField21>Hiekkalaatikko</skyview:CustomField21> 

Not sure what you mean by static/variable value? This metadata was input as text and it varies from image to image (tells the original location where the image was stored).

 

Thanks for the help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2023 Nov 30, 2023

So the value (location name) is variable and not static/fixed. You may need to change and or add/remove extra criteria as required.

 

A simple Edit > Find (which can then be saved as a dynamic smart collection) does the job:

 

2023-11-30_22-19-00.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

Sorry if I got something wrong, but this leaves me with a problem since the first criteria is found in all files, the latter criteria is found from other metadata fields in other files.

What would work for me (as far as I understand) is if the search would find "Hiekkalaatikko" from skyview:CustomField21. Or the whole text "<skyview:CustomField21>Puulajipuisto</skyview:CustomField21>", but I guess it doesn't work that way (look for such string)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2023 Nov 30, 2023

Unfortunately Adobe doesn't let one use the < > characters in find. 

So this would then need a custom script.

 

If you're not adverse to using a CLI tool, then I can probably give you the code for ExifTool.

 

https://exiftool.org

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

Ok, that's a shame. It would be a useful extra for the Find-tool

 

Anyhow, my problem still exists so I am more than eager to try ExifTool. I'm not hugely skilled with CLI tools, but also not new with the. So the code would be hugely appreciated. I think I can get it to work 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2023 Nov 30, 2023

@Sami33901227vjt3 

 

The following Mac OS Terminal ExifTool command line code will scan the top-level directory "My Folder" on the Desktop of a user named "jill" for any file that contains the required metadata and list the results in the Terminal window:

 

exiftool -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -XMP-skyview:CustomField21 '/Users/jill/Desktop/My Folder/'

 

This Mac OS Terminal ExifTool command line code will add a blue Adobe Bridge Label "Review" to any matching files.

 

exiftool -overwrite_original_in_place -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -label='Review' '/Users/jill/Desktop/My Folder/'

 

Instead of using a label, a Bridge rating could be used, such as 5 stars... Or perhaps a keyword or other metadata value could be added. Or the file could be renamed or moved to another directory. There are many possibilities.

 

If you are using MS Windows, then all single straight quotes need to be changed to double straight quotes and the appropriate Windows directory path needs to be used.

 

Let me know if you need anything clarified.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

Thanks! You've already been a huge help!

 

ExifTools seems like the way to go.

 

For my current task the best method would be to move the files in question to another directory. Could you provide a script for that (Find files with CustomField21=Hiekkalaatikko --> Move to directory called Hiekkalaatikko)? This would be a killer!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 30, 2023 Nov 30, 2023

All Criteria is an AND so that search would require both items.

You could also write a custom search script to find this data.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

Thanks for the info, both of you!
A working script is something that I'm now trying to figure out. All help is appreciated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 30, 2023 Nov 30, 2023

I'm an experienced Bridge scripter and the search scripting is beyond opaque. I'd recommend using EXIFTool and writing a shell script or using my Run EXIFTool script in Bridge (it integrates Bridge and EXIFTool.)

https://www.dropbox.com/sh/mg817g9a9ymbasi/AADTmXUVxmFfM58bcyYE7yiwa?dl=0

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2023 Nov 30, 2023

@Sami33901227vjt3 

 

You can use the Bridge script "Expert Search" from Paul Riggott to create a collection from the specific search criteria:

 

https://github.com/Paul-Riggott/PS-Scripts/blob/master/Expert%20Search.jsx

 

2023-12-01_12-21-14.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

Well this does the trick, thanks!

 

However since I have some directories with a huge amount of files, Bridge tends to crash (or at least take years to process). I guess I could work around this by dividing files to smaller directories. But since ExifTool might get it done without the manual labor, I think I have to try it out first.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2023 Nov 30, 2023

@Sami33901227vjt3 

 

The following ExifTool code will conditionally move the matching files to a new folder named 'Hiekkalaatikko':

 

exiftool -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -directory=%d'Hiekkalaatikko' '/Users/jill/Desktop/My Folder/'

 

Keep in mind that this is simply processing the top-level of the target folder. You can add the -r or -recurse flag/argument to drill into nested sub-directories.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 01, 2023 Dec 01, 2023

Ok it took some time to learn how to use Exiftool, but it sure did do just what I wanted it to do! My learning curve has been phenomenal, thanks to you guys! 😄

 

I will now try to run this in the bigger folders - that in mind I would like to see what is going on, and save some log file.

I added -progress in the end of the command and it showed some information, but can I also save a log file of the progress?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2023 Dec 01, 2023

In addition to -progress, ensure that there is a space then add the following at the very end:

 

> 'path/to the/log.txt'

 

You may also wish to look into -v or -verbose

 

https://exiftool.org/exiftool_pod.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 01, 2023 Dec 01, 2023
LATEST

That worked as well. Thank you so much! You're a legend 😄

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines