Blush

Package VersionHex Docs

Blurhashed Lucy

Blush is a Gleam implementation of BlurHash.

This library implements the blurhash encoding/decoding algorithm, with validation of hash values.

Loading image data into an RGBA pixel array is the responsibility of the application consuming this library.

Installation

gleam add blush

Usage

To encode an image, you'll first need to figure out loading the image into a pixel array. This library does not provided a way to do this (for now).

After loading the image data choose values for x and y components - both should be an integer between 1 and 9 inclusive. The higher the components count, the higher output "quality", however - this also produces longer hashes.

If you're not sure, a good starting point could be 4x4.

// Ok("LEHLk~WB2yk8pyo0adR*.7kCMdnj")
let result = blush.encode(
  ImageData(width: 240, height: 320, pixels: [...]),
  Components(x: 4, y: 4)
)