6

I'm looking for software to create PNG8 format transparent images as per this article.

NOTE: I need a Linux solution myself, but please submit answers for other OSes.

8 Answers 8

6

pngquant does a good job of converting to PNG8 while preserving full transparency.

If you're size-conscious, you may also be interested in pngcrush, which can usually (losslessly) compress PNG files quite a bit.

3
  • 2
    I'll also recommend pngout; it tends to beat almost every other optimizer in my experience due to its custom DEFLATE library. Oct 2, 2008 at 4:39
  • Wow. Just tried pngout, and it blew the doors off what libpng generates. I wish the dude would release his custom zlib...
    – Mike F
    Oct 2, 2008 at 6:19
  • 2
    To simplify compressing 8-bit PNG images we've created an online service at tinypng.org.
    – molf
    Jun 24, 2012 at 22:26
4

I also needed a Linux solution and found pngnq to do a pretty good job. It seems to be designed specifically for creating 8-bit PNG images with alpha channels.

apt-get install pngnq # If on Ubuntu/Debian
1

For Mac: ImageOptim and ImageAlpha are GUIs that run pngcrush, pngquant, and various other normally command-line compression utilities. http://pngmini.com/

1

The link you provided references ImageMagick, which is an excellent toolkit for manipulating images on Linux.

2
  • I tried using Image Magick as per the comment but the resulting image was messed up
    – grom
    Oct 2, 2008 at 5:33
  • I don't think Image Magick supports 8-bit PNG with more than 1-bit alpha transparency. At least I couldn't figure out how to make it generate them.
    – davr
    Sep 30, 2009 at 22:01
1

Ah, if I remember correctly, when I have read this article some months ago, pngquant hadn't a Windows version. I see it has one now. So I tried it, and pngnq too.

The latter seems to do a slightly better job on the IceAlpha.png test image (from libpng.org), at the cost of a slightly bigger image (it can be post-processed with pngcrush or pngout anyway).

The dithering algorithms (the two of pngquant, the only one of pngnq) are different, and it might be worth having both tools, converting images with all algorithms and see what looks the best.

For the record, on the Windows side, IrfanView (4.10) displays these images very well (using the transparency level on each palette entry) while XnView (1.85.1) and GIMP (2.4) apply only a full transparency/opaque display, à la GIF: the light bulb given as an example in the linked article has a transparent background around it, but the orange part is fully opaque.

And the excellent utility TweakPNG shows we have a PLTE (palette, 222 entries) chunk and a tRNS (alpha values for palette colors, 222 entries) chunk. Even more, it allows to edit each palette entry, color and alpha level. It might be an interesting complementary tool for this format.

Note on IrfanView support: if it handles PNG8 correctly for transparency, it doesn't handle gamma information in PNG files: on the toucan image or the ping-pong image, I had to apply a gamma of 2.4 to get similar (lighter) colors.

Note also that IrfanView does an awful job of converting 32-bit PNG images to 256, allowing only one transparent color, which looks bad if full color was dithered!

I see that the GIMP manual states: "his “PNG8” format, like GIF, uses only one bit for transparency; only two transparency levels are possible, transparent or opaque. " while the ISO/W3C standard states: "The tRNS chunk specifies either alpha values that are associated with palette entries (for indexed-colour images) or a single transparent colour (for greyscale and truecolour images).". The PNG specification 1.2 added: "Although simple transparency is not as elegant as the full alpha channel, it requires less storage space and is sufficient for many common cases." It looks like the unique transparent color is more implemented than the full transparency palette, alas. At least browsers get it right.

1

It depends on what exactly your original images look like.

If your images already contain 256 or fewer colors (RGBA values), you need only look at pngout (Windows) (Linux/BSD/Mac OS X ports), which you should already be using to optimize your PNG images anyway. It can't quantize images, but it can save them as 8-bit, including alpha transparency. Just pass in the /c3 (or -c3 on Linux et al.) color option to force it to save the image as PNG8.

If your images do contain more than 256 colors, you have a few more, but all less than perfect options:

  • Adobe Fireworks is probably the best option in terms of the resulting image quality. It will do the job if you only need to convert a few images, or if you don't mind relying on Fireworks to do the batch processing. I did find that it sometimes somehow limits the number of colors in the palette, creating a worse quality image than necessary. I don't know if that's perhaps a bug in CS3 that's been fixed in CS4.

    If you're not on Windows or OS X this obviously isn't an option, and buying Fireworks just for this probably isn't worth it either.

  • The only alternatives I know of are the already mentioned pngquant and pngnq. I've had better luck with pngnq, but that's probably just going to depend on which quantization strategy works best on the files you're working with.

    Unfortunately, I've noticed that neither of them work very well with small amounts of transparency (say, an opaque image with transparent, rounded corners).

0

I recommend "The GIMP" as it is possible to output in PNG8 and supports Linux/Windows. If you want a quick Windows-only solution, I also recommend IrfanView.

6
  • 1
    Yeah I usually use GIMP, but in that article it says "I can certainly confirm that none of PhotoShop, Gimp, Paintshop Pro, or Xara has this functionality built-in."
    – grom
    Oct 2, 2008 at 4:39
  • The following article suggests that PNG8 is the default for GIMP, but I may very well be wrong with that. It looks like some other people have good suggestions too. docs.gimp.org/en/gimp-images-out.html Oct 2, 2008 at 4:42
  • 2
    Although GIMP lets you created index PNG (ie. PNG8) it doesn't support having alpha channel for one or more palette entries. So unable to achieve the effect as per the article.
    – grom
    Oct 7, 2008 at 2:09
  • Note the page you link to states: "More, this “PNG8” format, like GIF, uses only one bit for transparency; only two transparency levels are possible, transparent or opaque." Looks like somebody is mistaken here.
    – PhiLho
    Oct 23, 2008 at 11:53
  • 1
    Luke: It is possible, but not common, to have full alpha transparency, eg up to 255 levels of partially transparent image, in PNG8 format images. That's what he's asking about. GIMP does NOT support generating this type of image...if you convert down to an indexed image, it only gives you on/off transparency, not a whole range of levels.
    – davr
    Sep 30, 2009 at 22:08
0

Microsoft Windows: Ultimate Paint (freeware and shareware versions are available).

Both versions can save as an 8 bit transparent PNG image.

It can also save as a 4 bit PNG (16 colours). This cuts the file size in half compared to 8 bit.

Input formats include BMP, GIF, ICO, JPG/JPEG and PNG.

The freeware edition of Ultimate Paint Standard 2.88 LE can be downloaded directly from http://www.ultimatepaint.com/up.zip (1.7 MB).

2
  • Please don't be the first to edit closed questions when your edit doesn't make the question reopen-able (i.e. doesn't make it on-topic). Questions get one and only one free entry-by-edit into the reopen queue. Your edit here usurped the OP's opportunity to easily get their question seen by people who might vote to reopen, in order to make an edit that was just correcting grammar. Yes, if the question is open, or if you weren't the first user to edit the question after it was closed, or if you voted-to-close, then, great, fix the post's grammar.
    – Makyen
    Jan 6, 2019 at 0:46
  • But, when your edit would be the first one after closure and you didn't vote-to-close, then please don't make such edits, unless they make the question something that should be reopened. [Please ping me here once you've read these comments so I can delete them, as they have nothing to do with this post.]
    – Makyen
    Jan 6, 2019 at 0:46

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.