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

Why my 16 bit psd image is save as 48 bit png image when I use js script ?

Explorer ,
Apr 06, 2023 Apr 06, 2023

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?

TOPICS
Actions and scripting
687
Translate
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 , Apr 06, 2023 Apr 06, 2023

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).

Translate
Adobe
Community Expert ,
Apr 06, 2023 Apr 06, 2023

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).

Translate
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
Explorer ,
Apr 06, 2023 Apr 06, 2023
LATEST

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.

Translate
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