Comment by IvanK_net

2 years ago

Lossy compression is possible in PNG to a certain degree. This is the "same PNG", but 94 kB instead of 1015 kB:

1015 kB: https://sidbala.com/content/images/2016/11/outputFrame.png

94 kB: https://www.photopea.com/keynote.png

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.

      1 reply →