5 Replies Latest reply on May 6, 2017 3:13 PM by Chuck Uebele

    PS script to edit Bridge labels?

    laetitiau16784699 Level 1

      Hi all, is it possible to run a script in photoshop to edit bridge labels? I'm reviewing several hundred images and need to label them based on image quality, but I have to open them in photoshop first to determine the quality. (For example, if it's good I'll give it a green label, if it's bad then red, if it's passable then yellow.) Is there a way to edit the label through PS rather than clicking back and forth between PS and bridge? It seems like exiftool might be a possibility but I don't know enough about it to say for sure.

       

      ETA: Forgot to add I'm using a PC

        • 1. Re: PS script to edit Bridge labels?
          Stephen_A_Marsh Adobe Community Professional

          I presume that you are not opening images one by one into Photoshop for inspection, then returning to Bridge etc.

           

          Why can’t you use Bridge in Filmstrip or Preview workspaces with the loupe to save roundtrips to Photoshop for visual inspection?

           

          It might be possible for an Adobe Photoshop script to directly add the metadata for a Bridge label from within Photoshop. I can’t script, however I do know a little ExifTool.

           

          ExifTool can certainly label the images for you, however you would have to identify the images somehow in Photoshop for the ExifTool to automated method to pick up. This could be adding metadata such as keyword or a blank content named text layer (presuming PSD or TIFF retaining the text layer) or something else with a specific value that would be picked up later and used as a “hook” to add a Bridge label against.

           

          One way to do this would be to use an action to add file info metadata, however you would need to save the files, which would not be great if they were say JPEG files.

          • 2. Re: PS script to edit Bridge labels?
            SuperMerlin Level 5

            If you did want to label in Photoshop this script should do it.

            N.B. you must save the file after labeling! (not save for web removing all metadata).

            #target photoshop;
            app.bringToFront();
            
            if(documents.length) main();
            function main(){
            var win = new Window("dialog","Label");
            g = win.graphics;
            var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);
            g.backgroundColor = myBrush;
            win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"}); 
            win.g1 = win.p1.add('group');
            win.g1.rb1 = win.g1.add("radiobutton",undefined,"Select");
            win.g1.rb1.value=true;
            rb1= win.g1.rb1.graphics;
            rb1.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
            rb1.foregroundColor =rb1.newPen (rb1.PenType.SOLID_COLOR, [1.00, 0.00, 0.00, 1],lineWidth=1);
            rb2= win.g1.rb1.graphics;
            win.g1.rb2 = win.g1.add("radiobutton",undefined,"Second");
            rb2= win.g1.rb2.graphics;
            rb2.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
            rb2.foregroundColor =rb2.newPen (rb2.PenType.SOLID_COLOR, [1.00, 0.80, 0.00, 1],lineWidth=1);
            win.g1.rb3 = win.g1.add("radiobutton",undefined,"Approved");
            rb3= win.g1.rb3.graphics;
            rb3.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
            rb3.foregroundColor =rb3.newPen (rb3.PenType.SOLID_COLOR, [0.00, 1.00, 0.00, 1],lineWidth=1);
            win.g1.rb4 = win.g1.add("radiobutton",undefined,"Review");
            rb4= win.g1.rb4.graphics;
            rb4.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
            rb4.foregroundColor =rb4.newPen (rb4.PenType.SOLID_COLOR, [0.00, 0.00, 1.00, 1],lineWidth=1);
            win.g1.rb5 = win.g1.add("radiobutton",undefined,"To Do");
            rb5= win.g1.rb5.graphics;
            rb5.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
            rb5.foregroundColor =rb5.newPen (rb5.PenType.SOLID_COLOR, [1.00, 0.00, 1.00, 1],lineWidth=1);
            win.g2 = win.p1.add('group');
            win.g2.bu1 = win.g2.add("button",undefined,"Label");
            win.g2.bu1.preferredSize=[200,40];
            win.g2.bu2 = win.g2.add("button",undefined,"Cancel");
            win.g2.bu2.preferredSize=[200,40];
            win.g2.bu1.onClick=function(){
            win.close(0);
            if(win.g1.rb1.value) label = "Select";
            if(win.g1.rb2.value) label = "Second";
            if(win.g1.rb3.value) label = "Approved";
            if(win.g1.rb4.value) label = "Review";
            if(win.g1.rb5.value) label = "To Do";
            if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");     
            var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);       
            xmp.deleteProperty(XMPConst.NS_XMP, "Label");   
            xmp.setProperty(XMPConst.NS_XMP, "Label",label);  
            app.activeDocument.xmpMetadata.rawData = xmp.serialize(); 
            }
            win.show();
            };
            
            
            
            
            1 person found this helpful
            • 3. Re: PS script to edit Bridge labels?
              laetitiau16784699 Level 1

              Wow, this is exactly what I was hoping to do! Thank you so much!

               

              Stephen, I think I can use your "hook" idea for some other things I'm working on. Thanks!

              • 4. Re: PS script to edit Bridge labels?
                Stephen_A_Marsh Adobe Community Professional

                Just shout out if you need any help with the hook!

                • 5. Re: PS script to edit Bridge labels?
                  Chuck Uebele Adobe Community Professional & MVP

                  You should be careful, as to what SuperMerlin said about the script,namely having to save the images. If you're working with jpgs, you will be recompressing the image and causing further degradation. Changing the metadata in Bridge, such as changing the labels only changes the metadata, and doesn't resave the file.