API Reference
Options
Reference for BlurKitOptions used by encode() and encodeMany().
Option object
Use this page when you need predictable placeholder dimensions, algorithm selection, or output format control.
Encode with explicit dimensions
import { encode } from 'blurkit/node'
await encode('./public/hero.jpg', { algorithm: 'thumbhash', width: 40, height: 24, outputFormat: 'jpeg',})Defaults
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.
Algorithm-specific options
componentXandcomponentYonly affectblurhash.- Cache helpers are runtime-specific: see API: Cache for the full matrix.