by Drahken » Wed Dec 07, 2005 4:35 pm
#1) All PNGs are lossless.
There are a few people tinkering with the idea of lossy PNGs, but even these actually result in lossless files, they just apply some lossy filters before saving. All PNGs are compressed with the zlib deflate format, which is very closely related to ZIP, and is completely lossless.
The only PNGs that have any data loss are 256 color/indexed PNGs. These PNGs are reduced to 256 colors before saving (just like GIFs), but are otherwise completely lossless (again, just like GIFs).
2) The compression setting in PNG is merely a tradeoff between filesize and speed. You should never use 0 compression, as it does not decrease compression time at all vs a setting of 1 (technically, it would have to, but it would only be in the range of about 1 bilisecond), yet results in a massive file. (0 level PNGs are slightly larger than even the bloated BMPs, because they also have no compression, plus they have some extra headers.) Level 6 is the standard/default setting, 9 gives slightly smaller files, but can be noticeably slower (especially on large images).
Hmm... I just ran a quick test to compare file sizes with different compression settings, and found that level 3 was actually smallest. It made a big jump in size from 3 to 4, and never went back down quite as far, even up to level 9. I wonder if it's related to xnview (not all programs handle PNGs the same. Photoshop for instance, is known to create bloated PNGs), the image itself, or if this always holds true. I will have to run some more experiments with different images and differe programs and see what happens.
EDIT: I just ran some tests, and it's related to the specific image. Complex, photographic-type images achieve the smallest size at a compression level of 3, then jump at level 4. Simpler, graphic-type images follow the expected pattern and achieve their smallest size at level 9. (Some achieve the smallest size at level 4 and then remain at that size from 5-9, some continually get smaller until they reach level 9, but none make that sudden jump that the photographic images do.)