Armel Larcier
Armel Larcier

Reputation: 16027

How safe am I using PNG-8 in web pages

PNG-8 is awesome for simple images with a rather small number of colors.

Images saved under that format are sharp and very light.

For example, exporting a two color map of french regions (430x470px), here is a mini-benchmark:

PNG-24 (no transparency)  :     34.6KB     perfect image
JPEG (100% quality)       :       76KB     perfect image
JPEG (75% quality)        :       33KB     almost perfect image
JPEG (50% quality)        :     15.7KB     very messy result
GIF (32 colors)           :     13.4KB     perfect image
PNG-8 (32 colors)         :     13.1KB     perfect image

As I'd rather use PNG, I'd like to know whether it's safe to use PNG-8 or if there are known rendering problems on some devices/browsers.

Upvotes: 1

Views: 1473

Answers (2)

Glenn Randers-Pehrson
Glenn Randers-Pehrson

Reputation: 12455

The designation "PNG8" is a little ambigous. Usually it means 8-bit indexed PNG with optional binary transparency (like GIF), and that is what is well supported, even by old versions of Internet Explorer. This is what you get from ImageMagick or GraphicsMagick when you request PNG8 output.

Sometimes it means 8-bit indexed PNG with full transparency (conveyed by the PNG tRNS chunk), and that may not be quite as well supported, and wasn't supported by old IE, which is why we came up with PNG8 in the first place.

From discussion among the PNG developers on png-list, October 12, 2002:

"Adobe ImageReady and Photoshop's save-for-web option use the terms PNG8 and PNG24 so:

  • PNG8 means indexed-color with 8-bit sample depth. Binary transparency is supported, but not full-alpha tRNS-type.
  • PNG24 means 24-bit RGB or 32-bit RGBA, depending on whether transparency is enabled."

I don't know if that's still true of ImageReady or Photoshop.

I am thinking of using the term "PNG88" to refer to indexed PNG with 8-bit transparency. Such images can be created by "pngquant" but they aren't given a particular name by pngquant. It refers to them as 8-bit RGBA-palette PNGs.

Upvotes: 1

Quentin
Quentin

Reputation: 943527

PNG-8 has better support than PNG-24. There are no problems using it.

Upvotes: 2

Related Questions