#comparing ImageMagick `-strip` vs. zopflipng vs. JPEG XL (for pixel art)

7 messages · Page 1 of 1 (latest)

lunar tartan
#

I have been working on a pixel art story, and mostly for the fun of it, I decided to try to reduce the size of my images, just to compare how well different approaches did at it.

I tried using plain magick -strip on the PNGs, zopflipng, lossless JPEG XL, and also loossless WebP. Now, maybe I did something wrong, but WebP did so terrible compared to the others that I decided to not even include it in the results.

The results I got were as follows. (Note that I named the zopfli PNGs as .zpng mostly just so I could separate them using a glob.)

 327 cover.png
1.9K page-I.png
2.0K page-II.png
2.6K page-III.png
1.8K page-IV.png
1.9K prologue.png

 322 cover.zpng
1.7K page-I.zpng
1.8K page-II.zpng
2.4K page-III.zpng
1.6K page-IV.zpng
1.7K prologue.zpng

 325 cover.jxl
1.4K page-I.jxl
1.5K page-II.jxl
2.2K page-III.jxl
1.2K page-IV.jxl
1.4K prologue.jxl

Here are the commands I used:

for n in *.png
do cjxl --distance=0 --effort=9 --brotli_effort=11 "$n" "${n%%.png}.jxl"
done

for n in *.png
do zopflipng "$n" "${n%%.png}.zpng"
done

If anyone finds this at all interesting, I can provide more exact file sizes.

sterile pendant
#

have you tried oxipng?

lunar tartan
#

I just did, and it seems to be slightly worse than zopflipng, except for two cases, in which it seems identical.
(with oxipng -Z -o 6 --strip all *.opng)

 327  cover.png
 322  cover.opng
 322  cover.zpng
 325  cover.jxl

1883  prologue.png
1690  prologue.opng
1688  prologue.zpng
1422  prologue.jxl

1870  page-I.png
1677  page-I.opng
1681  page-I.zpng
1374  page-I.jxl

2002  page-II.png
1774  page-II.opng
1768  page-II.zpng
1456  page-II.jxl

2646  page-III.png
2373  page-III.zpng
2373  page-III.opng
2184  page-III.jxl

1741  page-IV.png
1613  page-IV.opng
1611  page-IV.zpng
1203  page-IV.jxl
sleek grotto
#

Interesting how good jxl is. I wonder, for pixel art, lossy compression might work decently well, depending on the details? Do you know about https://squoosh.app?

lunar tartan
#

Interesting how good jxl is.
Yes, JPEG XL is fantastic! I’m really miffed about Chrome’s decision to not implement it. (As I side note, I just made a browser extension for Chrome and Firefox that uses jxl.js to add support for it. I just submitted it for approval to Google and Mozilla, let’s see how it goes.)

I do know about squoosh.app! And when i tried to use lossy compression, it seemed to make the images larger in file size. I could try again to see what I end up getting.

left wasp
#

Lossy compression is absolutely an option for larger pixel arts (256x256 and up), as quantizing the hell out of low frequency data that doesn't contribute much has little discernible impact on image quality. It depends on the data set, if this is an educational exercise you might even play around with your own run length encoding scheme (like CCITT group 4 - but with color) if you have long stretches of same color. It will get stomped by gif and png but it's fun to learn.

That is all masturbatory though. Put on your get shit done hat and the best option becomes choose the most compatible and don't sweat a few extra kilobytes. imagemagick pngs can't go wrong.