A better PNG minifier

over 5 years ago from Ivan Kutskir, Programmer

  • Vlad Danilov, over 5 years ago

    "hard problem to solve in the browser" - what do you mean by that?

    Just check out code complexity in the linked projects.

    I don't think that tools that you mentioned can do a better job than UPNG.

    I've updated the comment with the link to image. Can you make it this small without changing the number of colors?

    Dithering may improve the visual quality, but it also usually increases the file size (by creating noise), that is why I avoid it.

    It's not for everything. But without it, images containing gradients have noticeable quality degradation. Dithering can also be applied selectively.

    0 points
    • Ivan KutskirIvan Kutskir, over 5 years ago

      Just because some project is more complex, does not mean it works better. I also don't understand what does it have to do with browsers.

      Your bunny.png is 23.3 kB. My bunny.png https://imgur.com/a/XGaTX from UPNG.js is 20.4 kB and I doubt you can see any difference.

      0 points
      • Vlad Danilov, over 5 years ago

        The 23.3 kB is 254 colors. The 20.4 kB is just 25 colors, and just 15.1 kB (-26.1%) losslessly compressed with a better tool. That's the difference.

        2 points
        • Ivan KutskirIvan Kutskir, over 5 years ago

          That is truly amazing! I guess the 15.1 kB version was made by trying different orderings of palette and different filtering options. I could do that in 6 lines of code, but this part would take too much time ...

          How long did it take? I guess it was more than 50 milliseconds.

          0 points
          • Vlad Danilov, over 5 years ago

            It is time consuming, takes seconds. You need all the performance you have.

            Type trials, palette sorting, filter brute forcing, nearly-optimal Deflate compression, etc. It's way more than 6 lines of code to do it properly.

            With bit-optimal parsing and elaborate heuristics you can probably get close and keep top performance.

            0 points