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

How to limit the number of keywords in Bridge

Explorer ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

I use Bridge to edit Title and keywords on my images, then I upload to Adobe Stock.
When I put keywords on my images I usually do it with copy and paste from internet sites.
However usually my images have almost 50 keywords, and I want to limit this number.
Is there a way to limit the number of keywords in Bridge, or, better yet, cut some of them in Bridge with the purpose to have at most 30 of them in every image?
Thanks in advance

 

TOPICS
Feature request , How to , Metadata , Scripting

Views

1.9K

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
LEGEND ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

Just uncheck the ones you don't want to use.

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
Explorer ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

Yes, but I was looking for a script / plugin that cuts the number of keywords to a certain number (for example 25 keywords). This procedure must be applied to a folder of images.

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
LEGEND ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

How does the script know which 25 to keep?

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
Explorer ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Simply the first 25 keywords. They are already sorted by importance.

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
LEGEND ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Grab my Utility Script Pack (its open source) and edit Keyword Optimizer to 1. not sort keywords and 2. remove anything over 25.

 

https://exchange.adobe.com/creativecloud.details.101130.utility-script-pack-for-bridge.html

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
Explorer ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Thanks a lot!

I will download it and try asap.

Can I ask you for help should I need it?

 

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
Explorer ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

I tried to download it but I get the error "The file cannot be downloaded at the moment, please try again later."

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
LEGEND ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

You'd have to contact the Adobe Exchange folks if the download isn't working.

 

Understand that there is no mechanism for putting keywords "in order." It doesn't exist. Keywords are physically written to a file in the order they are added, and a file viewer decides how to order them when displaying metadata. So you may very well not get what you are looking for even with a script.

Same when you upload a file. There is this idea that keywords can be put in some order but the XMP spec does not have a standard for doing that, and they could be parsed in any arbitrary order by the stock site.

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
Explorer ,
Feb 21, 2020 Feb 21, 2020

Copy link to clipboard

Copied

I was able to download it and install it.

However I don't find the script in Bridge.

I don't know where to find it.

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
Explorer ,
Feb 22, 2020 Feb 22, 2020

Copy link to clipboard

Copied

Actually I downloaded a file Utility Script Pack for Bridge_2.1.2.zxp and a need a .jsx file.

Where can I find it?

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
LEGEND ,
Feb 22, 2020 Feb 22, 2020

Copy link to clipboard

Copied

The .zxp file is Adobe's offshoot of zip for downloads. Did you use the Adobe CC app? You have to turn on file sync and it should automatically download.

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 ,
Feb 24, 2020 Feb 24, 2020

Copy link to clipboard

Copied

Entering the keywords in the following order, with a mixutre of digits and alphabetical characters:

 

1, 2, 3, 4, 5, six, 7, eight

 

Has the following display in Bridge CC2019:

 

Screen Shot 2020-02-25 at 12.24.46.png

 

Screen Shot 2020-02-25 at 12.24.53.png

 

Screen Shot 2020-02-25 at 12.26.04.png

 

So as Lumigraphics notes, even within Adobe software, the display order is not consistent.

 

At least the raw data of file info matches what ExifTool states, which is the order of input/entry:

 

 

[IPTC] Keywords : 1, 2, 3, 4, 5, six, 7, eight 
[XMP-dc] Subject : 1, 2, 3, 4, 5, six, 7, eight

 

 

So a solution using ExifTool is readily available, if you are willing to use a CLI based program (there are GUI front ends that can be used to hide most of the command line use of ExifTool if one does need a crutch).

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 ,
Feb 24, 2020 Feb 24, 2020

Copy link to clipboard

Copied

Yes the display is not the same as the order of the keywords. Here is a javascript that should do the job for selected documents.

#target bridge  
   if( BridgeTalk.appName == "bridge" ) {  
keyLimit = MenuElement.create("command", "Limit Keywords", "at the end of tools");
}
keyLimit.onSelect = function () { 
//adjust to suit
NumberOfKeywords = 25;
try{
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var sels = app.document.selections;
for(var a =0;a<sels.length;a++){
var thumb =  new  Thumbnail( sels[a] );
var md = thumb.synchronousMetadata;
var xmp =  new XMPMeta(md.serialize());
if(!xmp.doesPropertyExist(XMPConst.NS_DC, "subject")) continue;
var keys =[];
keys = getArrayItems(XMPConst.NS_DC,"subject");
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;
};
if(keys.length > NumberOfKeywords){
xmp.deleteProperty(XMPConst.NS_DC,'subject');
for(var k =0;k<NumberOfKeywords;k++){
xmp.appendArrayItem(XMPConst.NS_DC, 'subject', keys[k], 0,XMPConst.PROP_IS_ARRAY);
}
}
var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
thumb.metadata = new Metadata(updatedPacket);
}
}catch(e){alert(e + "\n" + e.line);}
};

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

 

exiftool -sep '###' '-MWG:Keywords<${MWG:Keywords;my @a=split /###/,$val;$#a>4 and $#a=4;$_ = join "###",@a}' 'FILEorFOLDERpath'

 

 

Notes:

 

* Always work on duplicates of the originals until you are happy with the results

 

* The ### characters stand for a keyword separator/delimiter, which could be any unique character string that is not found in the actual keywords. For example, a comma would be acceptable if no keywords contained a comma.

 

* This example retains the first 5 keywords. Change the two occurrences of the digit 4 with the required number, less one (the count starts at zero... 0,1,2,3,4 = 5 keywords)

 

* Replace 'FILEorFOLDERpath' with the full path to the file or top-level folder

 

* This command is formatted for the Mac, Windows users would swap single quotes for double quotes and double quotes for single quotes

 

* This command will affect both legacy IPTC Keywords and their DC Subject counterparts

 

* Further arguments can be added to process all subfolders under the top-level folder and to overwrite the original files rather than to create a duplicate backup file with _original at the end

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
LEGEND ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

LATEST

Keywords are written to the file in order of entry. That would be the only way to ensure that the relevant ones are kept- by NOT working in any software that re-orders them.

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

Great job as always SuperMerlin!

 

I extended your script with a very simple interactive prompt. There is no error checking or safeguards to ensure that only digits are entered, however that should not be too hard to add if required.

 

 

//Limit Keywords with Prompt.jsx
//How to limit the number of keywords in Bridge
//community.adobe.com/t5/bridge/how-to-limit-the-number-of-keywords-in-bridge/m-p/10945147

#target bridge
if (BridgeTalk.appName == "bridge") {
   keyLimit = MenuElement.create("command", "Limit Keywords", "at the end of tools");
}
keyLimit.onSelect = function () {
   // Interactive Step
   NumberOfKeywords = Window.prompt("Please enter the keyword length limit:", "5");
   try {
      if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
      var sels = app.document.selections;
      for (var a = 0; a < sels.length; a++) {
         var thumb = new Thumbnail(sels[a]);
         var md = thumb.synchronousMetadata;
         var xmp = new XMPMeta(md.serialize());
         if (!xmp.doesPropertyExist(XMPConst.NS_DC, "subject")) continue;
         var keys = [];
         keys = getArrayItems(XMPConst.NS_DC, "subject");

         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;
         };
         if (keys.length > NumberOfKeywords) {
            xmp.deleteProperty(XMPConst.NS_DC, 'subject');
            for (var k = 0; k < NumberOfKeywords; k++) {
               xmp.appendArrayItem(XMPConst.NS_DC, 'subject', keys[k], 0, XMPConst.PROP_IS_ARRAY);
            }
         }
         var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
         thumb.metadata = new Metadata(updatedPacket);
      }
   } catch (e) {
      alert(e + "\n" + e.line);
   }
};

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

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