5 ms·
Currently, https://josephg.com/sp/current https://josephg.com/sp/current returns a png with 3x8 (RGB) bits/pixel. But since the image has only 16 colors, you ca
by frakturfreund 9y ago
Currently, https://josephg.com/sp/current https://josephg.com/sp/current returns a png with 3x8 (RGB) bits/pixel. But since the image has only 16 colors, you can reduce its filesize to ~20% (from ~714 to ~147 KB, with http://optipng.sourceforge.net/ http://optipng.sourceforge.net/). Can't you can gain performance and reduce bandwith by keeping the image serverside as a 4 bit png?
- josephg 9y agoYes. I wanted to do that, but I couldn't find a png library on npm that supports encoding 4 bit paletted pngs. Fixing that was on my todo list from day 1. Although now that I think about it, I could probably get close by using an 8bit greyscale image and then apply the palette in the client. That would probably halve the image size.
- Drdrdrq 9y agoCool project! Optipng does many other optimisations but could be taxing on CPU. It should be very easy to put it in the stack for test though.