Copy link to clipboard
Copied
I'm working on a script where I need to export certain assets as 32 bit PNGs (PNG24 + Alpha). When exporting these manually - Quick Export as PNG works perfectly every time and preserves an alpha bit depth - even if the image has no transparency. But Quick Export as PNG doesn't work in scripting.
When I've tried exporting via other means, when the image in question doesn't have transparency the export results in no alpha bit depth. Is there a way to force alpha bit depth via other export means in scripting?
I've tried using various save for web legacy scripting settings with transparency = true, as well as normal save scripts that set the file type to PNG, but so far the only 2 methods that preserve transparency are Quick Export as PNG and the Generator Image assets - but from what I can tell there is no way to 'toggle' Generator on/off within a script.
Any help would be appreciated!
Copy link to clipboard
Copied
Turn off the layer. Save an empty file as PNG (with not a copy!).
Turn on layer. Save (not save as) the file.
Bingo.
Copy link to clipboard
Copied
Unfortunately resaving the file per your method above does not preserve the alpha bit depth when the layer is turned back on.
Copy link to clipboard
Copied
Yes, exactly, on CC2018 does not work. On CS6 works.
Copy link to clipboard
Copied
Unfortunately part of the reason for this script is so that multiple users on my team can use it - forcing them to install previous versions of Photoshop to run the script is counterintuitive for the end goal of speeding up workflow.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The tool for slotting these PNGs sometimes runs into errors if the bit depth is incorrect, so the tool we use to check these files always marks them as failing if they don't have 32 bit bit-depth. Since "Quick Export As..." always saves PNGs as 32 bit, for manual production of these files - it's not a problem. The problem only occurs when you try to automate this process to speed up workflow.
Copy link to clipboard
Copied
Quick Export as PNG does not save PNG's as 32 bit for me.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now