Skip to main content
Peter Celuch
Legend
August 18, 2010
Answered

PNGSaveOptions NOT working

  • August 18, 2010
  • 1 reply
  • 3489 views

Hi, I'm trying to save as PNG8 without transparency and with white background. I've searched forums and found one funcion, repeating over and over again in all posts, using various properties on class PNGSaveOptions which, according to ESTK help has no properties (!!!)

I changed PNG8 from false to true. Nothing changed! I changed whole bunch of properties and script keeps saving transparent PNG24, PNGSaveOptions are totaly ignored. Is it some kind of "feature" of CS5 or am I missing someting?

Please, humor me and try to use this function for PNG export:

function SavePNG(saveFile){
     pngSaveOptions = new PNGSaveOptions();
     pngSaveOptions.embedColorProfile = true;
     pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
     pngSaveOptions.matte = MatteType.WHITE;
     pngSaveOptions.quality = 1;
     pngSaveOptions.PNG8 = true;
     pngSaveOptions.transparency = false;
     activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
}

This topic has been closed for replies.
Correct answer Paul Riggott

Try this....


var saveFile = File(Folder.desktop +"/test.png");
sfwPNG24(saveFile);

function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = true;
pngOpts.transparency = false;
pngOpts.interlaced = false;
pngOpts.quality = 100;
activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);
}

1 reply

Paul Riggott
Paul RiggottCorrect answer
Inspiring
August 18, 2010

Try this....


var saveFile = File(Folder.desktop +"/test.png");
sfwPNG24(saveFile);

function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = true;
pngOpts.transparency = false;
pngOpts.interlaced = false;
pngOpts.quality = 100;
activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);
}

Peter Celuch
Legend
August 18, 2010

Thank you soo much!