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
Copy link to clipboard
Copied
Just uncheck the ones you don't want to use.
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.
Copy link to clipboard
Copied
How does the script know which 25 to keep?
Copy link to clipboard
Copied
Simply the first 25 keywords. They are already sorted by importance.
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
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?
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."
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.
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.
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?
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.
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:
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).
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);}
};
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
Copy link to clipboard
Copied
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.
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