Is png image format lossless?

ok, i have noticed some people where using .png for screenshots, so i tried it out, i noticed that with paints normal setting (what i have use for all the samples) it was the same size as the jpeg, but looked just as good, and when i zoomed in no “artifacts”, however when i used a photo it was little smaller, but still bmp quality, and jpeg was like 1/20 the size and still good quality. can somebody please explain how .png works and if most importantly it is completly lossless. thanks, ben :slight_smile:


bmp (1.38mb)
gif (95kb)
jpg (42kb)
png (47kb)


bmp (900kb)
gif (145kb)
jpg (46kb)
png (784kb)

ps. bmp is massive and probibly not worth looking at

it is lossless. i like it alot too. more info @

For image editing, either professional or otherwise, PNG provides a useful format for the storage of intermediate stages of editing. Since PNG’s compression is fully lossless–and since it supports up to 48-bit truecolor or 16-bit grayscale–saving, restoring and re-saving an image will not degrade its quality, unlike standard JPEG (even at its highest quality settings)…

PNG’s compression is among the best that can be had without losing image information and without paying patent fees, but not all implementations take full advantage of the available power. Even those that do can be thwarted by unwise choices on the part of the user.

PNG supports three main image types: truecolor, grayscale and palette-based (8-bit''). JPEG only supports the first two; GIF only the third (although it can fake grayscale by using a gray palette). The impact on compression comes from the ability to mix up image types in PNG. Specifically, forcing an application to save an 8-bit palette image as a 24-bit truecolor (orRGB’’) image is not going to result in a small file. This may be unavoidable if the original has been modified to include more than 256 colors (for example, if a continuous gradient background has been added), but many images intended for the Web have 256 or fewer colors.

PNG was created as an alternative to the patent-poisoned GIF format, and took on additional tasks that GIF never thought of.

GIF has a capability of up to 256 colour palettized, and also has the capability of interlace (for fast initial display), animation and transparancy (transparent colour). It uses a compression with UNISYS patents now expiring in most places in the world.

PNG can do palettized, and also truecolour, plus it supports alpha transparancy (though many browsers don’t) as well as more basic transparancy.
On the same material as GIF, it can often compress better, especially when fed through an optimizer such as PNGCRUSH, plus it can avoid reducing colour depth.
Even at maximum compression, PNG is still lossless, as it implies the same as maximum zip compression - just use more exhaustive searches for compressible areas of data.
For animation, there is the poorly supported MNG format.

JPG is a VERY poor choice for anything that demands pixel precision, since to preserve any degree of accuracy and clean-ness on text and line art, you end up setting low compression, and getting a large file.

JPG makes use of optical redundancy in photographic material, and will compress a photo far more than PNG would, but then PNG is lossles, unless you force a bit depth reduction.

PS. A tip for PNGCRUSH - given the way compression works, the best possible result will be found in full testing mode, with the compression locked to 9 - lower compressions might be faster, but if aiming for a “final”, applying max compression will never lose anything or be worse, and it will not slow down decompression.

cool thanks guys, will try this pngcrush :), also though what browsers support .png, my ie6 will, but does everyones, i dont want to be posting screenshots nobody can see.

  • ben :slight_smile: - A riveting read, and though the primary reason for avoiding GIF’s has now passed, it’s a salutory lesson, when trivial patents are being granted every day, and companies scour their archives for anything they’ve forgotten.

Applications with PNG support

The current browser support status of PNG, at it’s simplest, is that all browsers of any current significance offer at least basic support for PNG.

Thanks for your explanation Matth and Ghosters, as a website owner it’s stuff we should know as well, but I didn’t…

And now I do :wink:

oh btw i deleted the .bmp file as it was massive and we all know what a uncompressed bmp file looks like :), but my main worry about png is compatibility, what browsers have built in support for it, i dont want to be posting screenshots that some people cant see

thanks again,

ben :slight_smile: