User:Faalagorn/.webp test

From PZwiki

For PNG, I currently use this fork of zopfli with the following settings:

--iterations=100000 --mui=10000 --pass=1000 --all --mb=0 --slowfix --lossy_transparent --alpha_cleaners=bhvapw --statsdb --t=4 --v=6

Seems that it is possible to shove a byte here and there using ect:

ect -9 -strip --allfilters-b --pal_sort=120 --mt-deflate=4 --mt-file=4

alternatively --reuse after zopfli can help too, adding more iterations (tested up to -999999) doesn't seem to beat zopfli though.

For animated PNGs, I use

apngasm -o "Bagel Anim.png" BagelPlain.png BagelPoppy.png BagelSesame.png -d 1000

And then apngopt to optimize it:

apngopt -z2 -i10000 "Bagel Anim.png"

Food for thought, anyone ever thought about teaching AI to optimize files using zopfli instead of using tons of iterations, passess, palette ordering and brute forcing permutation? That'd probably work way better than StatsDB.

Below are the old test results:

All example are images and 18px thumbnails followed by resulting image files.

Static

  • Lighting indoor 01 0.pngLighting indoor 01 0.png – 474 bytes

./zopflipng --iterations=1000000 --mui=10000 --all --lossy_transparent --lossy_8bit --alpha_cleaners=bhvapw --statsdb --t=4 --v=6 unopt/lighting_indoor_01_0.png opt/lighting_indoor_01_0.png

  • Lighting indoor 01 0.webpLighting indoor 01 0.webp – 408 bytes (≈13.92% smaller)

cwebp -m 6 -pass 10 -mt -lossless lighting_indoor_01_0.png -o lighting_indoor_01_0.webp

Animated

  • IndustrialFridge.gifIndustrialFridge.gifIndustrialFridge.gif – 15016 bytes
gifsicle -O3 --no-extensions IndustrialFridge.gif -o IndustrialFridge.gif
  • IndustrialFridge.pngIndustrialFridge.pngIndustrialFridge.png – 12761 bytes (≈15.02% smaller)
ffmpeg -i IndustrialFridge.gif -plays 0 IndustrialFridge.apng
apngopt -z2 -i100000 IndustrialFridge.apng
gif2webp -m 6 -mt IndustrialFridge.gif -o IndustrialFridge.webp

Tools used

I use multithreading on 4 cores where possible, but that shouldn't affect compression.

Conclusions

All encodings done are lossless (except for possible transparency colors that are not normally seen), meaning no pixel should be lost over the original – for GIF I'd have to compare with the original, since GIF only supports 256 colors, but APNG and WEBP are lossless to the source images.

However, there are some issues:

  • WEBP static images are converted to PNG before showing, so any gain is lost.
  • Optimized GIF thumbnail seems to be distorted.
  • APNG thumbnail seems to only display the 1st frame.
  • Animated WEBP seems not to show anything at all.

Static WEBP images have over 10% savings in size and compression times are way faster as compared to zopfli, especially the extreme profiles I use – decompression speed should be pretty similar according to tests online, however WEBP animations seems not to work on wiki at all as of the edit (11:00, 24 January 2021 (UTC)) – it does work on Chromium 88.0.4324.96 and Firefox 84.0.2 if opened manually as well as Chrome 87.0.4280.141 and Firefox Focus 84.0.2 on Android, but not if embedded on MediaWiki. I have yet to see how older browsers support it (Mac prior to Big Sur and Windows prior to Windows 7, plus some exotic browsers on, e.g., older mobile devices).

If you have any suggestions or comments, feel free to leave me a message on my talk page or ping me on Discord.