finds.dev← search

// the find

evanw/thumbhash

★ 4,159 · Swift · MIT · updated May 2024

A very compact representation of an image placeholder

ThumbHash encodes a tiny (~30 byte) placeholder representation of an image that you can store inline and decode client-side before the real image loads. It improves on BlurHash by preserving aspect ratio, supporting alpha, and producing better color accuracy — all with comparable code complexity. Aimed at any developer who wants smooth image loading without a round-trip to generate a server-side placeholder.

The algorithm encodes aspect ratio inside the hash itself, which means you don't need to store width and height separately — that's a genuine ergonomic win over BlurHash. Multi-language coverage (JS, Rust, Swift, Java in-tree; Go, PHP, Ruby, Perl out-of-tree) means you can encode server-side and decode anywhere without reimplementing the math. The JS implementation is a single self-contained file with no dependencies, easy to inline or tree-shake. Alpha channel support is a real differentiator — BlurHash just doesn't handle transparency, full stop.

The repo has been effectively dormant since May 2024 with only 90 forks and no package distribution for most languages — the Java implementation is raw source files with no build system, which is annoying to integrate. Parameters aren't tunable by design, so if the default quality tradeoff doesn't work for your use case (very small images, specific color profiles), you're stuck. No benchmark data comparing encode/decode performance across implementations, which matters if you're encoding at upload time in a hot path. The Swift implementation ships as a single file with no Swift Package Manager support, which is out of step with how Swift packages are distributed today.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →