雨山


Dithering

2018-10-26


As I mentioned a while back, I'm running my websites on a Raspberry Pi. At the moment, it's plugged into a wall power outlet as you'd expect. But I'd eventually like to run it on solar power. I don't know how soon that'll be; I have a lot of learning to do in that respect. But I've found a couple of resources for education and inspiration here and here.

In the meantime, I've started trying to pare down the resources needed to serve the sites. The first step has been to implement image dithering to reduce image size. I first wrote my own implementation based on what I learned in this excellent article. It worked, but it was super slow. So, instead, I opted to use ditherjs, followed by Trimage. All of the images on this site have now been dithered! Hooray!

Just for fun, here's a dithered image of my new favorite reading spot! After resizing, dithering, and compressing, it went from 837KB down to 32KB, a 96% reduction!

/res/img/couch.jpg