Hacker News new | past | comments | ask | show | jobs | submit login

PNG is not lossy, your example uses a preprocessor to quantize colors before being compressed with PNG.

PNG loss no information from the image being fed to it, the loss was done before creating a simpler image.




I know that the "lossines" is not included in PNG encoders, as it is in JPG / WEBP encoders. But the idea is the same: if you are ready to "accept some loss" (by reducing the number of colors in this case), you can get a much smaller PNG file.


You can get a smaller uncompressed bitmap by reducing color count too reducing bits per pixel, that does not mean bmp is a lossy compression scheme. Color quantization will reduce the final size of the image in nearly all image formats jpg/webp would benefit as well.

You could have an artist or AI render the picture as a cartoon and png will highly compress it more than the original that does not mean PNG is a lossy compression scheme.

You could take a photo with a low resolution camera and it will be smaller than a higher resolution one after PNG compression, again nothing to do with PNG.

It is no surprise simpler images with less information compress better with lossless formats than more complex ones.

Your example implies that the PNG format itself has a lossy mode, when instead its just the way the image is preprocessed which has no limit on techniques that can lose information to make the image smaller independent of the codec.


You can have a PNG and JPG versoin of the original image without no loss, and the files would be about the same size.

You can have a PNG and JPG version of the original image, with the same loss - "average error per pixel", and the files would be about the same size.

I know there is no lossy compression described in a PNG standard. But there exist programs which produce tiny PNG files with a loss. So comparing an MP4 encoder with a bult-in loss to a PNG encoder without any built-in loss is not fair. They should have made the MP4 encoder encode the video in a lossless way, just like they did with PNG.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: