Skip to main content
Legend
August 20, 2021
Question

Bridge bug - ICC profile in PNG file deleted

  • August 20, 2021
  • 0 replies
  • 147 views

Bridge incorrectly alters the metadata in PNG files to remove the ICC profile tag after purging cache.

 

Steps to reproduce:

 

Bridge 11.1.1, Photoshop 22.5, Windows 10 Pro 21H1

 

1. Save a PNG file from Photoshop with ICC profile embedded.

2. View in Bridge, File Info->Raw Data

3. Right click->Purge cache for selection

4. View in Bridge, File Info->Raw Data

 

Expected: ICC profile tag intact

Actual: ICC profile tag removed

 

Note that when opened in Photoshop, PS File Info shows the ICC profile tag intact and PS correctly identifies the profile.

 

Example screenshots before/after cache purge. This is a PNG file with profile saved in Photoshop 22.5. Also tested with a Bridge script that writes the XMP tag to file metadata.

 

 

For completeness, this Bridge script will add an ICC profile to PNG files:

 

 

 

#target bridge

main()

function main(){
    try{
        if(app.document.selectionLength > 0){ //test for no selection
           var thumbs = app.document.getSelection('png'); //get selected files of enumerated types
            }
        else{
            alert('No files selected! Please select supported image files to enable export.');
            thumbs = null;
            return;
            }
        if(thumbs.length != 0){ //are any valid files selected
            if(ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'); //load library for metadata
            var fileMeta = thumbs[0].synchronousMetadata; //new metadata object
            var xmp = new XMPMeta(fileMeta.serialize());
            for(var a = 0; a < thumbs.length; a++){
                fileMeta = thumbs[a].synchronousMetadata; //new metadata object
                xmp = new XMPMeta(fileMeta.serialize());
                xmp.setProperty('http://ns.adobe.com/photoshop/1.0/', 'ICCProfile', 'sRGB IEC61966-2.1', 0); //set ICC profile tag
                var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT); //write updated XMP
                thumbs[a].metadata = new Metadata(updatedPacket); //save to file
                }
            }
        }
    catch(e){
        alert(e + ' ' + e.line);
        }
    }

 

 

This topic has been closed for replies.