Monday, November 6, 2017

Method to Export PNG-8 w/ Partial Transparency in Adobe PS CC Other Than "Quick Export" / "Export As"?


I previously asked "How to Batch Export All Directory Contents to PNG-8, Overwriting Existing Files?". The answer I received appears to be technically correct. But I forgot to mention one serious criteria -- my image has partial transparency.


Hence if my test image is:


test -- original


File > Export > Quick Export to png-8 or Export (picking png-8) produces a beautifully visually equivalent file:



test -- png-8 w/ Quick Export


Where as Export > Layers to Files and Export > Save For Web (Legacy) produce the image seen on the right (image on left is original):


test -- png-8 Save for Web


My issue is that most of my images I'm trying to export via Batch Actions rely on partial transparency. But the only two export to png-8 options I can find that seem to support partial transparency aren't currently supported by actions.


I get the Save for Web one, as per the hard edges motivation Adobe elaborates upon here. I don't understand as well why the layer export is also doing matteing on partial transparency, with no hint of this in the dialog (maybe a bug?) and w/ no way to even pick the matte color, for that matter (the automatically selected matteing is #ffffff in the color space of some of the content).


Are there any other ways to export to png-8, w/ partial transparency OTHER than Export as and Quick Export to png-8?



Answer



Here's a solution – using only Photoshop... IF your files all have the same dimensions.



  • Be sure to check 'Smaller File (8-bit)' under 'Quick Export Format' (found by going to File > Export > Export Preferences)


  • Go to File > Scripts > Load Files into Stack

  • Click on the first layer in the Layers Panel and Shift+click on the last to highlight all layers

  • Right-click directly on the layers and choose 'Export As' or 'Quick Export as PNG-8...'


Done


~~~~~~~~ ~~~~~~~~ ~~~~~~~~


EDIT: If your files are of differing dimensions (or if the above method isn't working out for you for whatever reason) and you simply must have PNG-8s you can always download the old SuperPNG plugin for Photoshop, available here...


Photoshop can now give better results than SuperPNG right out of the box using 'Export'– but not in an Action/batch. Once you have the plugin installed you can create an action/batch and 'Save As' SuperPNG. This method was capable of outputting PNG-8 files with 8-bit transparency long before Photoshop could...


Here is your original image above (which started at 93kb) saved out from Photoshop using SuperPNG:


SuperPNG example



To produce this result (weighing in at 60.5kb) I used the following settings:


SuperPNG dialog


I could get the file size lower but it caused some unsightly banding. Results of course will vary with different images. Perhaps you can get better results by messing around with the settings...


Anyway after running that file through "The Gauntlet" I got this result:


SuperPNG after the Guantlet


This image is 38kb.


Note that this is only marginally smaller than the 32-bit example generated using PNGGauntlet in my other answer – but it is a PNG-8 with 8-bit transparency:


Image Properties


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...