0

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?

  • I think if you will need to go to png 24 to achieve full tranprency – John Drach Jun 29 '17 at 22:17
  • As far as I can tell Quick Export to PNG and Export as.. and ticking the "smaller file (8-bit)" option both save as a PNG24 image. My version of Photoshop CC2017 has no Quick Export to PNG-8 item. – Scott Jun 29 '17 at 22:53
  • 1
    @Metis 'Quick Export to PNG' and 'Export as' both save to 8-bit for me (PS CC 2017.1.1)... In order to see 'Quick Export to PNG-8' you have to go to Edit > Preferences > Export (or File > Export > Export Preferences) and check 'Smaller File (8-bit)' under 'Quick Export Format'. – BANG Jun 30 '17 at 5:44
  • 1
    @BANG From my usage here, when exporting it seems if the file contains any transparency at all, a 32bit PNG is saved, even if you tick that "smaller (8-bit)" option. The smaller 8-bit refers to color not compression, there's a difference. The only way you actually get a PNG8 file using export commands is if the file contains zero transparency. You can see this by exporting a range of images with and without transparency... then reopen those exports and check the color mode. The actual PNG8 file will be in Index mode, as it should be. – Scott Jun 30 '17 at 7:30
  • 1
    That's not true. There is such thing as a PNG-8 with 8 bit alpha transparency. This is what you get with Photoshop's Export PNG-8 feature. The option does not say "smaller (8-bit)"... It says "Smaller File (8-bit)". The number of colors in a PNG file is directly related to the file size. Less colors = smaller file size. – BANG Jun 30 '17 at 10:03
2

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

  • TinyPNG also has a Photoshop plugin which can apparently export PNG-8s with 8-bit alpha – but it's not free... – BANG Jul 1 '17 at 3:24
  • "Similar colors in your image are combined. This technique is called “quantization”. By reducing the number of colors, 24-bit PNG files can be converted to much smaller 8-bit indexed color images. All unnecessary metadata is stripped too. The result: better PNG files with 100% support for transparency." – TinyPNG – BANG Jul 1 '17 at 4:12
  • "The plugin supports batch automation to compress many images at once. First you will need to create a Photoshop action that uses the plugin..." – TinyPNG – BANG Jul 1 '17 at 4:14
1

Forget Photoshop in this case... and don't get stuck on PNG-8 either. With partial transparency (in my opinion) PNG-24 (actually PNG-32) is the only way to go.

Use PNGGauntlet. And you're done.

Here is your sample image after having run it "through the gauntlet":

Fully Optimized

File size has been reduced from 93.4kb to 39.9kb:

PNGGauntlet UI

Your PNG8 example above is 40.6kb so we did even better than that without needing Photoshop or PNG8.

Cheers

  • I'd consider doing this, but I'd want to run it on an offline machine with no connectivity as it's a non open source third party program and I'm dealing with proprietary image content that has pretty strict corporate security standards. Photoshop is approved... I wouldn't want to run any unapproved third party app on an internet connected machine without being able to view the source code. So this is an option but a more time consuming one. :) – Jason R. Mick Jun 30 '17 at 14:20
  • @JasonR.Mick Ah OK, gotcha... There is always pngquant as well (seems to be open source). Just tried out their PNGoo Windows GUI (batch capable) this morning and it got your original file down to 40.5kb while still looking good: PNGoo'd Cheers – BANG Jun 30 '17 at 21:43
  • Found an even better way but it's definitely not open source. The undisputed champion weighing in at 18.6kb (!) : Super Small – BANG Jun 30 '17 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.