Skip to main content
joshem813
Participant
March 4, 2021
Question

PNG files are saving larger than they should be on macOS through Photoshop 2021

  • March 4, 2021
  • 3 replies
  • 651 views

I have had an issue lately where photoshop will save what should be basic files in massive file sizes. i.e. an ongoing project I have that I update weekely typically saves to png at about 2mb. Lately it's been saving as 18-19mb with nothing changed in size or density. Any ideas?

 

 

{Thread title edited by moderator}

This topic has been closed for replies.

3 replies

Stephen Marsh
Community Expert
Community Expert
March 5, 2021
rob day
Community Expert
Community Expert
March 6, 2021

Hi Stephen, I wrote a script that opens an InDesign document’s image links via the Bridgetalk class and runs your metadata removal function.  It runs without error but I don’t have any bloated examples to test. I think the bloat can get transferred into the ID document, so I’m guessing you would have to save the ID doc as IDML after running the script to fully clear the metadata.

 

 

 

 

/*
* Clear ancestor metadata from document images
* Version 1.0
* Rob Day 2020-2021
*/

#target indesign
#targetengine "session" 

var doc = app.documents.item(0);
var lnks = removeDuplicates(doc.links.everyItem().name)

var lPaths = [];

for (var i = 0; i < lnks.length; i++){
    var l = doc.links.itemByName(lnks[i])
    if (l.parent.constructor.name == "Image" && l.status != 1819109747) {
        lPaths.push(l.filePath)
    } 
};   

//Send the array of file paths to Photoshop
runPhotoshop(lPaths);


/**
* Update the ID links after Photoshop saves 
* @Return void 
* 
*/
function upDate(){
    var lks = doc.links;
    
    for (var i = 0; i < lks.length; i++){
        //$.writeln(lks[i].name + " Uppdate")
        while (lks[i].status != LinkStatus.NORMAL) {
            lks[i].update();
        }
    };   
}


/**
* Opens Photoshop via Bridgetalk and run psScript() function
* @9397041 the array of file paths to open 
* @Return value void
* 
*/
function runPhotoshop(a){
    var bt = new BridgeTalk();  
    bt.target = "photoshop";  
    bt.body = "var a = "+a.toSource()+";"  
    bt.body += psScript.toString() + "psScript();";

    bt.onResult = function(resObj) {
        upDate()
    }  

    bt.onError = function( inBT ) { alert(inBT.body); };  
    bt.send(8);  
      
    function psScript() {  
        for (var i = 0; i < a.length; i++){
        var d = open(File(a[i]));
        //https://community.adobe.com/t5/indesign/file-size-is-too-big/td-p/9370587/page/2
        if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");   
            var xmp = new XMPMeta( activeDocument.xmpMetadata.rawData);   
            xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");   
            d.xmpMetadata.rawData = xmp.serialize(); 
            d.save();
            //$.writeln(d.name + " Saved")
            d.close();
        }; 
    }  
}


/**
* Removes duplicates from the array
* @9397041 an array to edit 
* @Return an array with no duplicates 
* https://community.adobe.com/t5/indesign/js-how-to-remove-duplicate-items-from-an-array/td-p/3044978
*/

function removeDuplicates(a){
    var ra = new Array();
    var o = new Object()
    for( i=0 ; i<a.length ; ++i ){
        o[a[i]] = null;
    }
    for( a[i] in o ){
        ra.push(a[i]);
    }
    return ra;
}

 

 

 

 

 

 

 

Stephen Marsh
Community Expert
Community Expert
March 6, 2021

Hi Rob, this is mentioned in solution #6 in the link previously provided at my Prepression blog.

 

After updating the links, all one needs to do is a Save as of the .indd file to clean out any garbage (overwriting the original or to a new file, not a simple save). No need for .idml which should probably be avoided unless absolutely necessary.

 

Full credit to the original script authors, all I have done is to collect and host these various scripts.

 

I can share some images that contain excessive metadata if you like, these were example files from others reporting the issue in years gone by.

 

 

rob day
Community Expert
Community Expert
March 5, 2021

It could be accumulated metadata. See the last 10 posts in this thread:

 

https://community.adobe.com/t5/indesign/file-size-is-too-big/td-p/9370587/page/3

nikunj.m
Legend
March 5, 2021

Hi,

 

We're sorry about the trouble with Photoshop. Would you mind telling us which macOS version are you working on? How are you saving the PNG files?

 

You can try to reset the preferences of Photoshop using the steps mentioned here: https://adobe.ly/2Qzc0K3

Please backup your settings prior to resetting the preferences. You can check: https://adobe.ly/2vNz6FG

 

Let us know how it goes!

Regards,

Nikunj

joshem813
joshem813Author
Participant
March 7, 2021

Thanks for the reply. I'm on the latest version of Big Sur running latest photoshop through Rosetta on an M1 MBP. However, I have also previously noticed this recently on my iMac running the final update to Catalina. I'm saving the png through 'Save As' as I usually do and it's not a problem I can consistently reproduce.