Copy link to clipboard
Copied
I use those js scripts.
This script just does "saveAs png exporting", but it always saves my 16 bit psd image as 48 bit png file.
var doc = activeDocument;
var exportPath = doc.fullName.toString().replace(/\.psd$/, '.png');
var newDoc = doc.duplicate();
fileObj = new File( exportPath )
pngOpt = new PNGSaveOptions();
pngOpt.interlaced = false;
activeDocument.saveAs(fileObj, pngOpt, true, Extension.LOWERCASE);
newDoc.close(SaveOptions.DONOTSAVECHANGES);
and this script, it just does what I need. It saves my 16 bit psd image as 24 bit png image(or 32 bit png image if it contains alpha channel.).
preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var exportPath = doc.fullName.toString().replace(/\.psd$/, '.png');
var newDoc = doc.duplicate();
var webOpt = new ExportOptionsSaveForWeb();
webOpt.format = SaveDocumentType.PNG;
webOpt.PNG8 = false; // PNG-24
var newFile = new File(exportPath);
newDoc.exportDocument(newFile, ExportType.SAVEFORWEB, webOpt);
newDoc.close(SaveOptions.DONOTSAVECHANGES);
I don't know why 1st script always makes 48 bit png image.
Is it caused by limitation of "saveAs" command? I need to use saveforweb to make 24 bit png image?
Just different notation.
16 bits per channel x 3 = 48 bits total.
If you need to convert to 8 bits per channel you need to invoke Image > Mode somewhere in your script.
Save for web automatically and always converts to 8 bpc (16 bit makes no sense for web).
Copy link to clipboard
Copied
Just different notation.
16 bits per channel x 3 = 48 bits total.
If you need to convert to 8 bits per channel you need to invoke Image > Mode somewhere in your script.
Save for web automatically and always converts to 8 bpc (16 bit makes no sense for web).
Copy link to clipboard
Copied
ah thank you. I just misunderstood bit depth thing. I edited my image in 16 Bits/channel mode so if I export them it should be 48 bit png image. I didn't know save for web exporting always makes 8 Bits mode image.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now