Blurhash is an algorithm written by Dag Ågren for Wolt (woltapp/blurhash) that encodes an image into a short (~20-30 byte) ASCII string. When you decode the string back into an image, you get a gradient of colors that represent the original image. This can be useful for scenarios where you want an image placeholder before loading, or even to censor the contents of an image a la Mastodon.
nimble install blurhash
Add requires "blurhash"
to your .nimble
file.
import blurhash, imageman/[images, colors]
let
image = loadImage[ColorRGB]("image.png")
hash = image.encode(5, 5)
echo hash
This snippet hashes following image into this compact string: UrQ]$mfQ~qj@ocofWFWB?bj[D%azf6WBj[t7
import blurhash, imageman/images
let image = "UrQ]$mfQ~qj@ocofWFWB?bj[D%azf6WBj[t7".decode[ColorRGBU](500, 500)
image.savePNG "blurred.png"
This results in following image:
Reference image author - https://rigani.me
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oJABtYBp-1629332631551)(https://ducafecat.tech/2021/08/19/translation/exploring-blurhash-image-placeholder-in-flutter/2021-08-19-06-32-44.png)] 原文 https://medium
go-blurhash A pure Go implementation of Blurhash. The API is stable, however the hashing function in either direction may not be. Blurhash is an algorithm written by Dag Ågren for Wolt (woltapp/blurha
Blurhash ��️ Give your users the loading experience they want. Install via npm: npm i react-native-blurhashnpx pod-install BlurHash is a compact representation of a placeholder for an image. Instead o