Kali Charan Rajput
Kali Charan Rajput

Reputation: 12646

which format of png should I use?

Which format of PNG should I use PNG 8 or PNG 24? Which one is better for a website. I am confused about these. What is main different between PNG 8 and PNG 2?

Upvotes: 3

Views: 2005

Answers (4)

Kornel
Kornel

Reputation: 100220

I've written article about it: PNG that works, which outlines all major variants of PNG and their trade-offs/compatibility.

In short, use PNG8 (paletted) whenever you can, as it has much smaller file size. You can have full alpha transparency in PNG8 if you use good tools (Photoshop is not good for PNG).

Upvotes: 0

Malcolm
Malcolm

Reputation: 41498

PNG has several modes which can be used. It may contain:

  • Greyscale
  • Indexed colour, usually meant by PNG-8
  • Greayscale with alpha
  • Truecolour (RGB)
  • Truecolour with alpha (RGBA), usually meant by PNG-24

Indexed colour is different from the others that it is a palette of maximum 256 colours, from which indexes are used to denote the colour of specific pixels. It can contain transparency via an auxillary chunk. So every pixel is denoted by a byte-wide value or even less if palette isn't that big. If you use truecolour, there will be more data per pixel, depending on whether you use an alpha-channel.

So in a large image indexed colour will save you a lot of data per each pixel. However, if you use more than 256 colours, some colour data will be lost, which is also more probable in a large image. I would advise to save your image in both formats and see if the loss is worth the gain in smaller file size. Though if you are designing your image for normal web site, not for mobile phones, you should better use PNG-24 anyway, since no one will notice the difference in the size.

Upvotes: 1

ShinTakezou
ShinTakezou

Reputation: 9691

I would say that it depends on the image you want to store as PNG*, but in case you've doubts, PNG-24 is better: "true color" (8bits per channel), so that the image must not be dithered and don't "loose" "exact" color match, and optionally PNG-32 if with the alpha channel (transparency) too. PNG-8 images are limited (256 colors chosen from a 24bit palette) and allow only for a mask, you can use it e.g. if you convert from a GIF image; if you convert from other "true color" formats, you "loose" "exact" color match as said (the program try to reduce the real number of used colors into only 256 colors, and other tricks to give resemblance with the original). Some style of icons do not need "true colors", they are "described" well by 256 "fixed" colors or less, and so PNG-8 is ok; as said, if you have GIF images as source, go for PNG-8... if you convert from JPG, go for PNG-24; if you create you image by yourself directly "in" PNG, you know if you can "crunch" the result in PNG-8 or not, but if you are not able to evaluate or use tools to evaluate, PNG-24/32 is ok in any case.

Upvotes: 0

smdrager
smdrager

Reputation: 7417

Png-24. Png-24 has alpha transparency (where Png-8 only has on/off transparency).

Png-8 is indexed. Png-24 is loss-less.

Png-24 is better in almost every way.

http://www.elated.com/articles/understanding-image-formats/

Upvotes: 3

Related Questions