waifu2x
waifu2x copied to clipboard
Optimize PNGs before serving them to the user (aka reduce filesize losslessly)
While I've absolutely no coding ability whatsoever (my expertise is much more in hardware), I couldn't help but notice that simply running something like "APNG Optimizer" (which works for non-animated PNGs as well) at even the default settings easily cuts down the filesize of a waifu2x'd image by like 10 to 20% while being quite fast to process as well (it also includes a zopfli implementation that gives a bit smaller size but is way slower to process).
As a real-world web app example, ezgif.com's APNG maker seems to implement the same libraries that APNG Optimizer relies on.
For reference, here's a link to the APNG Optimizer program, source, libraries: https://sourceforge.net/projects/apng/files/
Maybe even better: ZopfliPNG (https://github.com/google/zopfli)
Zopfli is actually included in APNG Optimizer as a non-default compression setting.
However, APNG Optimizer actually can at times result in farther smaller file size than Zopfli alone because it also will reduce the color pallete to the smallest lossless value and will also "clean up" anything left in transparent areas (sometimes they can contain the information for multiple colors even when the according colors are displayed as 100% transparent).
If it is lossless, I will try it. It also helps to reduce the communication cost of the web server.
If you're interested in reducing file sizes, why not go straight for WebP?
@c-edw WebP support only reached decent cross-browser support (~80%) in January 2019 with FF65 and Edge 18. Safari still doesn't support it yet.