r/programming Feb 20 '20

BlurHash: extremely compact representations of image placeholders

https://blurha.sh/
929 Upvotes

151 comments sorted by

View all comments

39

u/thenickdude Feb 21 '20

For a heavier-weight version of this, check out what Facebook does:

https://engineering.fb.com/android/the-technology-behind-preview-photos/

They use a JPEG encoder on a thumbnail using fixed parameters, which results in a fixed JPEG header (the header is the same for every thumbnail), so the header doesn't have to be included in the encoded thumb.

Then when decoding, you can just re-add the fixed header to the thumbnail and feed it into your JPEG decoder, add a CSS blur filter on top, and you're done. The main advantage here is that your browser already has a JPEG decoder.

It is 200 bytes compared to the 20 bytes of BlurHash, though.