API Reference
Options
Reference for BlurKitOptions used by encode() and encodeMany().
When to use
Section titled “When to use”Use this page when you need predictable placeholder dimensions, algorithm selection, or output format control.
Example
Section titled “Example”import { encode } from 'blurkit/node'
await encode('./public/hero.jpg', { algorithm: 'thumbhash', width: 40, height: 24, outputFormat: 'jpeg',})Inputs / Options / Behavior
Section titled “Inputs / Options / Behavior”interface BlurKitOptions { algorithm?: 'blurhash' | 'thumbhash' size?: number width?: number height?: number componentX?: number componentY?: number outputFormat?: 'png' | 'jpeg' cache?: BlurKitCache}Defaults:
algorithm:blurhashsize:32componentX:4componentY:3outputFormat:png
Dimension behavior:
sizescales longest side while preserving aspect ratio.widthonly derivesheightfrom source ratio.heightonly deriveswidthfrom source ratio.width+heightuses exact dimensions.
Limits / Caveats
Section titled “Limits / Caveats”componentXandcomponentYonly affectblurhash.- Built-in cache helper is provided via
blurkit/nodeonly.