README.md

# Blush

[![Package Version](https://img.shields.io/hexpm/v/blush)](https://hex.pm/packages/blush)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/blush/)

![Blurhashed Lucy](https://gitlab.com/vrba/blush/-/raw/main/docs/blurhash.png)

Blush is a Gleam implementation of [BlurHash](https://blurha.sh).

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

```sh
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.

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