7

I need to convert a 16bit png into an 8bit png for size reduction. Problem are the half transparent pixels that will generate a white border around my content when converting to 8bit. I just want to delete all pixels that are somewhere between 0 and 100% visible. How would I do it?

Tools available are Photoshop and Gimp (both newest versions).

Here is an example image:

enter image description here

17
  • Are you throwing away the transparency on purpose? 8-bit PNGs also allow it.
    – Jongware
    Commented Feb 13, 2018 at 15:42
  • The PNG8 format doesn't support multiple levels of transparency. It only has either totally opaque, or totally transparent pixels, no semi-transparency! PNG8 is a bit like a GIF, which also suffers from the same problem.
    – Billy Kerr
    Commented Feb 13, 2018 at 15:46
  • 1
    @BillyKerr: Don't let the bad support in Photoshop (for example) confuse you! The official specification does not contain such a restriction at all: "For [indexed-colour], alpha is a series of values [...] Each entry indicates that the corresponding palette index has the specified alpha. [..] [A] tRNS chunk may contain fewer values than there are palette entries; the remaining values are assumed to be 255. When only palette index 0 need be made transparent, only a one-byte tRNS is required ..." (paraphrased, but do read the full text)
    – Jongware
    Commented Feb 13, 2018 at 16:28
  • 1
    @usr2564301 I use GIMP too, you have to convert to Indexed mode to ouput a PNG8. Perhaps you have discovered a niche market for your software!
    – Billy Kerr
    Commented Feb 13, 2018 at 18:28
  • 1
    Sorry I meant "without semi transparent pixels". Also I confirmed imgur converts the image and just removes all the half transparent pixels.
    – steros
    Commented Feb 17, 2018 at 17:06

2 Answers 2

9
  • In the Layers panel, Ctrl+click (or, if on mac Cmd+click) the layer thumbnail to turn its transparency into a selection.
  • Use Select > Edit in Quick Mask Mode to enter Quick Mask Mode.
  • Use Image > Adjustments > Threshold and set the Threshold to 255, to remove all transparent pixels.
  • Push Ctrl+i (or if on mac Cmd + i) to inverse the mask.
  • Exit Quick Mask Mode with Select > Edit in Quick Mask Mode.
  • Make sure the layer is selected and press Delete to remove the transparent pixels.

This could be turned into an action.

3
  • So I tried and this works, but actually I don't need it as PS can save without semi transparent pixels.
    – steros
    Commented Feb 17, 2018 at 16:43
  • @DarsVaeda, I thought you already tried that, but that it gave your image a white outline.
    – Wolff
    Commented Feb 18, 2018 at 16:36
  • yes I tried but got the white outline. but I found an option to drop the transparent pixels now.
    – steros
    Commented Feb 19, 2018 at 9:06
1

To save without semi-transparent pixels as white pixels in Photoshop go to "Export for web" then select PNG 8bit. Check "Transparency" and select "none" as "Matte" color. For me this just removes the semi-transparent pixels alltogether.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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