[−][src]Crate blurhash
A pure Rust implementation of woltapp/blurhash.
Encoding
use blurhash::encode; use image::GenericImageView; let img = image::open("octocat.png").unwrap(); let (width, height) = img.dimensions(); let blurhash = encode(4, 3, width, height, &img.to_rgba().into_vec()); assert_eq!(blurhash, "LBAdAqof00WCqZj[PDay0.WB}pof");
Decoding
use blurhash::decode; let pixels = decode("LBAdAqof00WCqZj[PDay0.WB}pof", 50, 50, 1.0);
Functions
decode | Decodes the given blurhash to an image of the specified size. |
encode | Calculates the blurhash for an image using the given x and y component counts. |
linear_to_srgb | linear 0.0-1.0 floating point to srgb 0-255 integer conversion. |
srgb_to_linear | srgb 0-255 integer to linear 0.0-1.0 floating point conversion. |