API Reference
encode()
Encode one image input into a BlurResult placeholder object.
When to use
Section titled “When to use”Use encode() when one image should produce one placeholder result.
Example
Section titled “Example”import { encode } from 'blurkit/node'
const result = await encode('./public/hero.jpg', { algorithm: 'blurhash', size: 32, outputFormat: 'png',})Inputs / Options / Behavior
Section titled “Inputs / Options / Behavior”encode(input: BlurKitInput, options?: BlurKitOptions): Promise<BlurResult>
type BlurKitInput = string | URL | File | Blob | ArrayBuffer | Uint8Array- Runtime entrypoint determines which input forms are valid at runtime.
optionscontrols algorithm, target dimensions, output format, and optional cache.- Returns a
BlurResultwithdataURL,hash, dimensions, algorithm, and optionalmeta. Uint8Arrayinput (including NodeBuffer) is supported by every runtime that accepts raw bytes.blurkit/wasmaccepts remote URL/URL/Blob/ArrayBuffer/Uint8Array and decodes PNG/JPEG/WebP.blurkit/denoaccepts local paths, remote URL/URL/Blob/ArrayBuffer/Uint8Array with wasm-backed decode and canvas render.
Limits / Caveats
Section titled “Limits / Caveats”- Input support is runtime-specific.
- Remote URL input can fail from network or CORS constraints.