Skip to content

Instantly share code, notes, and snippets.

View its-arun's full-sized avatar

Arun Chaudhary its-arun

View GitHub Profile
@its-arun
its-arun / blurhashDataURL.ts
Created September 5, 2024 15:07 — forked from mattiaz9/blurhashDataURL.ts
Convert blurhash to a base64 DataURL string (no canvas or node-canvas)
import { decode } from "blurhash"
export function blurHashToDataURL(hash: string | undefined): string | undefined {
if (!hash) return undefined
const pixels = decode(hash, 32, 32)
const dataURL = parsePixels(pixels, 32, 32)
return dataURL
}