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

changing UPPER to lowercase keywords in Bridge or Lightroom

New Here ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Hello,

Apologies if this has been covered, but I'm new and somewhat on a deadline.

I have a batch of about 1,000 images for work that have been tagged with a keyword and then an ID number. They are currently in uppercase, but I need them in lowercase. The keyword and the ID number are also in quotations (to qualify them as a single keyword together).

Example:

current keyword, including quotation marks:

"BLSSI.COM_PERSON_ID=964820"

ideal:

"blssi.com_person_id=964820"

If it weren't for the quotation marks, I think I could figure out how to batch-rename them, but since they are in quotation marks, it makes for every file (which all have different numbers at the end) being its own, separate keyword. Does that make sense? I'm looking for a way to just change the letters within the quotation marks to lower case instead of upper case.

Is there any hope for me? I can also work in Lightroom, but I'm not savvy with scripts or coding. I'm on a Mac with Bridge 2017 and Lightroom CC (I can upgrade if need be, too).

thanks

Laura

Views

3.3K

Translate

Translate

Report

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 1 Correct answer

Community Expert , Dec 06, 2017 Dec 06, 2017

Hi Laura, yes there is hope!

I don’t have time to post the full solution now, however I’ll try to come back to you with an ExifTool example.

With luck somebody will post some script code for Bridge or Photoshop.

Votes

Translate

Translate
Community Expert ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Hi Laura, yes there is hope!

I don’t have time to post the full solution now, however I’ll try to come back to you with an ExifTool example.

With luck somebody will post some script code for Bridge or Photoshop.

Votes

Translate

Translate

Report

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
New Here ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

That would be awesome, but I would like to repeat that I don't know coding, and have never run a script before, so I would need that explained to me, if possible. I'm also on a company computer, so I don't want to mess anything up!

thanks so much Stephen

Votes

Translate

Translate

Report

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 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Don’t worry Laura, I’ll walk you through using ExifTool once I have time to workout the command line code…

As for Bridge scripts, you don’t need to know how to write scripts to use them. More here:

Prepression: Downloading and Installing Adobe Scripts

Votes

Translate

Translate

Report

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 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

This is turning out to be a little harder than I first thought… I’m now thinking that if you are on a deadline, that it may be quicker to export out the keywords from the source files to a spreadsheet file, use a formula to change all of the keywords from upper to lower case, then re-import the keywords again to update.

 

Prepression: Extracting Metadata to .CSV

 

Need a script to update keywords for 20000 images in Bridge

 

Script to add description and keywords to files from text file

 

Update image metadata from CSV --- urgent help

 

Exporting Bridge metadata to Excel or CSV

Votes

Translate

Translate

Report

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 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

You will need to download and install ExifTool:

 

ExifTool

 

Installation instructions here:

 

Installing ExifTool

 

ExifTool For Dummies

 

Getting started: Command-line ExifTool in Windows

 

______________________

 

The Mac OS CLI code:

 

exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject '/Users/username/Desktop/my file.jpg'

 

or

 

exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject '/Users/username/Desktop/my folder'

 

 

The Win OS CLI code is the same, however you would change the single straight quote marks to double straight quote marks and the path to the file or folder would of course be your Windows formatted path. Ensure that copy/paste does not change the quote marks from straight to curly!

 

I’ll try to post an animated screenshot later, work on copies of your original files. These commands will create a duplicate of the original file anyway, adding an _original to the original image filename while leaving the processed file named as per the original… It is also possible to turn of the safe duplicate feature, and to process files in sub folders under the main top level input folder, and to ignore certain file types or only process certain file types etc.

Votes

Translate

Translate

Report

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 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

Here is an animation, basically the same on both Mac and Windows. Mac uses Terminal, while Windows uses the CMD prompt. Type or copy the CLI code into the shell window, then drag the image file or folder file into the window and hit return.

exiftool-lowercase-scaled.gif

Votes

Translate

Translate

Report

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
New Here ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Hi Stephen,

I've read and re-read some of the links you sent me, and the animation was very helpful. I think I have a basic, elemental grasp on this process…

I installed ExifTool and opened Terminal. I have a folder called “test” on my desktop with copies of 10 jpgs to test. I pasted the following into the blank Terminal window (from a plaintext editor) :

exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject '/Users/lnunez/Desktop/test'

And made sure all the quotation marks remained straight. I then dragged the actual “test” folder into the Terminal window, hit enter, and it gave me this message:

Last login: Fri Dec  8 10:10:24 on ttys001

lnunez-imac:~ lnunez$ exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject '/Users/lnunez/Desktop/test'/Users/lnunez/Desktop/test

Error: error opening file - /Users/lnunez/Desktop/test/Users/lnunez/Desktop/test

    0 image files updated

    1 files weren't updated due to errors

lnunez-imac:~ lnunez$

So it seems like I did something right, but then something went wrong somewhere. I also tried it with just one file, like this:

exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject '/Users/lnunez/Desktop/AHAP000_PW225_H_34.jpg'

dragged that jpg into the window and hit enter, which gave me this error message:

Last login: Fri Dec  8 10:10:49 on ttys001

lnunez-imac:~ lnunez$ exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject '/Users/lnunez/Desktop/AHAP000_PW225_H_34.jpg'/Users/lnunez/Desktop/AHAP000_PW225_H_34.JPG

Error: error opening file - /Users/lnunez/Desktop/AHAP000_PW225_H_34.jpg/Users/lnunez/Desktop/AHAP000_PW225_H_34.JPG

    0 image files updated

    1 files weren't updated due to errors

lnunez-imac:~ lnunez$

Can you spot if and where I went wrong? I know the filenames are funky; they are sent to us this way… I hope that is not the cause of the problem.

thank you!

Votes

Translate

Translate

Report

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
New Here ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Also, does this change all keywords from all caps to all lowercase? Because I don't think that would be ideal. I am just trying to change one keyword. Which is frustrating, since this sounds so promising.

Votes

Translate

Translate

Report

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
Guide ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

This may help?

Although I do not know how you got quotes around the keyword as if I try they get removed.

#target bridge    

if( BridgeTalk.appName == "bridge" ) {   

var menu = MenuElement.find ('updateKeywords'); 

if (menu == null){ 

updateKeywords = MenuElement.create( "command", "Update Keywords", "-at the end of tools",  "updateKeywords" ); 

updateKeywords.onSelect = function () { 

if (ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript"); 

var sels = app.document.selections; 

for(var a in sels){ 

var xmpf = new XMPFile(sels.spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);  

var xmp = xmpf.getXMP(); 

var keys = getArrayItems(XMPConst.NS_DC,'subject'); 

xmp.deleteProperty(XMPConst.NS_DC,'subject'); 

        for(var s in keys){ 

           if(keys.toString().match(/BLSSI.COM_PERSON_ID/ig)) keys=keys.toString().toLowerCase();

        xmp.appendArrayItem(XMPConst.NS_DC, "subject", keys, 0,XMPConst.PROP_IS_ARRAY); 

        } 

if (xmpf.canPutXMP(xmp)) {  

        xmpf.putXMP(xmp); 

         xmpf.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);  

         }  

function getArrayItems(ns, prop){ 

var arrItem=[]; 

var items = xmp.countArrayItems(ns, prop); 

   for(var i = 1;i <= items;i++){ 

     arrItem.push(xmp.getArrayItem(ns, prop, i)); 

                } 

return arrItem; 

};

Votes

Translate

Translate

Report

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 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Great job SuperMerlin, thank you for providing a Bridge solution!

 

Laura, the following link will explain how to copy, paste, save and load the script code provided by SuperMerlin:

 

Prepression: Downloading and Installing Adobe Scripts

 

The installed script will be available under the Tools menu with the name “Update Keywords”.

Votes

Translate

Translate

Report

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
New Here ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Wow, thanks very much to both of you! I will try both methods out and let you know what happened.

Votes

Translate

Translate

Report

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
New Here ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Supermerlin,

This worked! I tested uploading some images to our software afterwards, and they are perfect. Thanks so very much, and thanks to Stephen for showing me how to save the code as a script and importing it to Bridge.

Stephen, I wanted to see if I could still do it with the exif tool. You’re right… I’m not sure how I thought I had to add the directory after the end of the bit of code you indicated, but omitting that, the process ran just fine. However, I did not see the changes we were aiming for reflected in the keywords after (I see that it made a copy of the file with _original at the end, and the change was not reflected in this file or the other copy without the _original). What DID change, however… well I’ll just show you:

original:

1920S PORTRAITS; BANGS; EV-IN; "MOORE,COLLEEN"; PORTRAIT; VPX COPY; ECPORT0612; ", BLSSI.COM_PERSON_ID=3019798"; HEADSHOT

modified:

1920s porTrAiTs; bAnGs; eV-in; "moore,colleen"; porTrAiT; VpX copY; ecporT0612; ", blssi.com_person_id=3019798"; HeAdsHoT

haaaaha. Look at that wild upper-and-lower case alternating!

If you want to get to the bottom of this, I’m willing to keep putting into practice what you want me to try, because I’m slowly learning some of this. Otherwise, I do think Supermerlin’s fix will allow me to finish the rest of my project. What shall we do?

again, so many thanks to both of you!!

Votes

Translate

Translate

Report

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 09, 2017 Dec 09, 2017

Copy link to clipboard

Copied

I am glad that SuperMerlin’s script does the trick!

For now, I’ll park this and return if/when I find the answer. The ExifTool command works fine on a single keyword, however I have not been able to produce the desired result, despite regular expression testers showing otherwise (so this may be a Perl syntax thing, rather than standard regex).

Votes

Translate

Translate

Report

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
New Here ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

Stephen,

Many, many thanks to you for all your assistance. I truly could not have done this without you, and I’m happy to say I now understand at least how to save scripts and install them in Bridge, so I’ve learned something, to boot!

Supermerlin you’ve saved me a lot of time and a lot of cramped fingers and wrists, something I am truly grateful for.

You both are wizards and we’re lucky to have you!

Laura

Votes

Translate

Translate

Report

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 19, 2017 Dec 19, 2017

Copy link to clipboard

Copied

I asked around and the following ExifTool command line code should work:

exiftool -api 'Filter=s/(BLSSI\.COM_PERSON_ID)/\L$1/i' -TagsFromFile @ -subject

Or:

exiftool -api 'Filter=s/(BLSSI\.COM_PERSON_ID)/blssi.com_person_id/i' -TagsFromFile @ -subject

Votes

Translate

Translate

Report

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 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Also, does this change all keywords from all caps to all lowercase? Because I don't think that would be ideal. I am just trying to change one keyword. Which is frustrating, since this sounds so promising.

Laura, If you look carefully at the error report and compare to my examples, you will see that the path to the file is repeated twice, when it should only be there once.

Don’t type or paste in the path to the file or folder. So only the bit in green, not red. Take a real close look at the animated screenshot…

exiftool -api 'Filter=tr/[A-Z]/[a-z]/' -TagsFromFile @ -subject 'Path/To/File or Folder'

Just input the actual CLI code and then put a space at the end. Then drag the file or folder from the Finder into Terminal to complete the command. No need for straight single quotes when you drop on the Mac, this is only necessary if the path has word spaces and you input the path without using escape characters.

Yes, all keywords would become lowercase. I might be able to change the search pattern, I was not aware that you needed this to be that specific… So if the keyword that should become lower case is always BLSSI.COM_PERSON_ID= and it is never different to this, apart from the numbers

exiftool -api 'Filter=tr/BLSSI\.COM_PERSON_ID/blssi\.com_person_id/' -TagsFromFile @ -subject

Votes

Translate

Translate

Report

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
New Here ,
Dec 19, 2017 Dec 19, 2017

Copy link to clipboard

Copied

Brilliant! This does work. I have an embarrassment of riches when it comes to options for fixing these keywords now. Thank you (both!) again so much, and hey, happy holidays in your corner of the world!

Votes

Translate

Translate

Report

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 19, 2017 Dec 19, 2017

Copy link to clipboard

Copied

LATEST

Not a problem Laura, please mark SuperMerlin’s reply #10 as the correct answer, thanks!

Votes

Translate

Translate

Report

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