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

Copy labels from jpeg proxies to hi res PSDs

New Here ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

Hey everyone!

 

Our team uses bridge to communicate which images are selects and comps between art directors and retouching through the label function (ie red is a select, yellow is a comp). All images are exported in both Hi Res PSD (for the retouchers to use) and Low Res JPEG (for the ADs who struggle to load the PSDs). They have the exact same filename - it's just the fily type that's different.

 

Often, it's only the JPEGs that get selected and not the PSDs, which slows down our process of finding the selects. 

 

Is there a workflow or script that could be used with Bridge to copy labels from a JPEG to the PSD with the corresponding file name?

 

If so, how would we go about creating this?

 

Thanks!

TOPICS
Batch , How to , Metadata , Scripting

Views

712

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 , Oct 24, 2022 Oct 24, 2022

@Angus5EBE the Exiftool is the simplest and fastest solution. If you still need a Bridge UI solution, here is a script that will find JPEG and PSD files with the same (exact) name and copy the Label, if there is one, from the JPEG to the PSD. The file extension is not case sensitive.

 

Once the script is installed, look for "Copy Labels (JPEG to PSD)" in the Tools menu. Test it thoroughly before using it on your production files.   Info on installing scripts.

 

#target bridge

/*
Terms and Condition
...

Votes

Translate

Translate
Community Expert ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

@Angus5EBE – Start by searching the forum and internet for a similar script. It may not be labels, it could be any type of metadata from file A to file B. It will be easier to change the metadata than writing the script from scratch. If you can point the forum to such a script, that would be a great help.

 

I have done similar for clipping paths with a Photoshop script, but it is pointless having to open both images just to update metadata. That is not to say that Photoshop can't read/write metadata without opening the pixel data (it can), it is just that I haven't done this for file pairs. It also makes sense to script this in Bridge rather than Photoshop, even if both are capable of the task.

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 ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

@Angus5EBE 

 

This is really easy to do with the command line ExifTool app...

 

Mac command (Terminal.app):

 

exiftool -overwrite_original -tagsfromfile %d%f.jpg -XMP-xmp:Label -ext .psd -r '/Mac/Folder/with both jpg and psd files'

 

Windows command (CMD.exe):

 

exiftool -overwrite_original -tagsfromfile %d%f.jpg -XMP-xmp:Label -ext .psd -r "C:\Win\Directory\with both jpg and psd files"

 

Work on copies of the original files for testing.

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 ,
Oct 24, 2022 Oct 24, 2022

Copy link to clipboard

Copied

@Angus5EBE the Exiftool is the simplest and fastest solution. If you still need a Bridge UI solution, here is a script that will find JPEG and PSD files with the same (exact) name and copy the Label, if there is one, from the JPEG to the PSD. The file extension is not case sensitive.

 

Once the script is installed, look for "Copy Labels (JPEG to PSD)" in the Tools menu. Test it thoroughly before using it on your production files.   Info on installing scripts.

 

#target bridge

/*
Terms and Conditions of Use:
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

// This script will find JPEG and PSD files with the same (exact) name and copy the Label, if there is one, from the JPEG to the PSD. The file extension is not case sensitive. To change which files are processed., change the values of search1 and search2.

// create menu item in Tools
if (BridgeTalk.appName == 'bridge') {
    var copyLabels_Label = "Copy Labels (JPEG to PSD)"; // use unique variable names at this level to avoid conflicts with other StartupScripts
    var copyLabels_Version = "2022-10-22";
    copyLabels_MenuItem = MenuElement.create("command", copyLabels_Label, "at the end of tools");
}

// when the menu item is clicked, run the script
copyLabels_MenuItem.onSelect = function () {
    copyLabels();
    }

function copyLabels(){
    // UI window
    var mainWindow = new Window ('dialog', copyLabels_Label);
    mainWindow.alignChildren = ['center','top'];
    mainWindow.preferredSize = [300,200];
    mainWindow.spacing = 10;
    
    var statictext1 = mainWindow.add('statictext', undefined, "When file names match exactly:");
    statictext1.preferredSize.height = 40;
       statictext1.alignment = 'fill';
        statictext1.justify = 'center';
        
    var statictext2 = mainWindow.add('statictext', undefined, "Copy Label from JPEG to PSD");
        statictext2.alignment = 'fill';
        statictext2.justify = 'center';
        
    var statictext3 = mainWindow.add('statictext', undefined, "(file extensions are not case senstive)");
        statictext3.alignment = 'fill';
        statictext3.justify = 'center';
        
    var spacer1 = mainWindow.add('statictext', undefined, "");
                
    var group3 = mainWindow.add('group', undefined); 
        group3.orientation = 'row'; 
        group3.spacing = 20; 
        var group3button1 = group3.add('button', undefined, "Run"); 
            group3button1.preferredSize = [80,30]; 
            group3button1.onClick = editXMP
        var group3button2 = group3.add('button', undefined, "Cancel"); 
            group3button2.preferredSize = [70,25];
            group3button2.onClick = function(){mainWindow.close();}
   
    mainWindow.show(); 
            
    // Functions
    function editXMP(){

        // Load the XMP Script library
        if ( ExternalObject.AdobeXMPScript == undefined ) {
            ExternalObject.AdobeXMPScript = new ExternalObject( "lib:AdobeXMPScript" );
            }

        var filePass = 0; // variable to count files successfully updated so it can be reported at the end
        var items = app.document.visibleThumbnails // array of all visible thumbnails in the active content panel
        var itemsCopyFrom = [];
        var itemsCopyTo = [];
        var search1 = ".jpg|.jpeg"; // primary file - label will be copied to search2 file
        var search2 = ".psd"; // copy label to this file

        for (var L1 = 0; L1 < items.length; L1++){ // loop through each thumbnail
            if(items[L1].name.match(new RegExp( search1, "i" )) != null){ // get just the jpg files
                itemsCopyFrom.push(items[L1]);
                }
            if(items[L1].name.match(new RegExp( search2, "i" )) != null){ // get just the psd files
                itemsCopyTo.push(items[L1]);
                }
            } // CLOSE for (var L1 = 0; L1 < items.length; L1++)

            // Since it is much faster to search for an element in an array by its key rather than its value, we create an index array, 'lookup', and copy all of the values from list2 as keys in lookup
            var lookup = {};

            for (var j in itemsCopyTo) {
                var noExt = itemsCopyTo[j].spec.fsName.substring(0, itemsCopyTo[j].spec.fsName.lastIndexOf (".")); // remove extension from file path/name for matching
                lookup[noExt] = itemsCopyTo[j];
                }

            for (var i in itemsCopyFrom) { // find items in itemsCopyFrom in itemsCopyTo
                var noExt2 = itemsCopyFrom[i].spec.fsName.substring(0, itemsCopyFrom[i].spec.fsName.lastIndexOf (".")); // remove extension from file path/name for matching
              if (typeof lookup[noExt2] != 'undefined') { // if there is a matching file name
               // set same label in itemsCopyTo
                var label = itemsCopyFrom[i].synchronousMetadata.read("http://ns.adobe.com/xap/1.0/", "Label") // read  itemsCopyFrom[i] label
                var label2 = lookup[noExt2].synchronousMetadata.read("http://ns.adobe.com/xap/1.0/", "Label") // read  itemsCopyTo label
                if (label.length > 0 && label != label2){ // if the jpeg has a label.  if the png has a label, only write if it is different from the jpeg
                    // TODO add options to only copy if JPG has a label or only copy if PNG doe not already have a label?
                    // TODO if JPEG does not have a label and PNG does, should PNG label be deleted?
                    var xmpFile = new XMPFile(lookup[noExt2].spec.fsName, XMPConst.UNKNOWN,XMPConst.OPEN_FOR_UPDATE); // create an XMP file
                    var xmp = xmpFile.getXMP(); // get the XMP data
                    
                    xmp.setProperty (XMPConst.NS_XMP, "Label", label); 

                    if (xmpFile.canPutXMP(xmp)) { // write new XMP to file
                        xmpFile.putXMP(xmp);
                        }
                    
                    xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
                    filePass++
                    } // CLOSE if (label != label2)
                } // CLOSE if (typeof lookup[noExt2] != 'undefined')
            } // CLOSE for (var i in itemsCopyFrom)

        mainWindow.close();
        alert(filePass+" files updated")
        } // CLOSE function editXMP()
    } // ClOSE function copyLabels()

 

 

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 ,
Oct 24, 2022 Oct 24, 2022

Copy link to clipboard

Copied

@gregreser – This is a fantastic script, kudos to you! I have marked this as the correct answer, thank you for posting such a great solution for Adobe Bridge. Although my ExifTool command does the same thing, I appreciate that many are scared away from the CLI, even if all it involves is a copy/paste and drag-n-drop.

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 ,
Oct 24, 2022 Oct 24, 2022

Copy link to clipboard

Copied

Literally slay thank you so much!! You're a lifesaver !!

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 ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

LATEST

You're very welcome.

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