Skip to content

Instantly share code, notes, and snippets.

View oleggrishechkin's full-sized avatar

Oleg Grishechkin oleggrishechkin

View GitHub Profile
@oleggrishechkin
oleggrishechkin / blurhashDataURL.ts
Last active November 17, 2023 16:43 — forked from mattiaz9/blurhashDataURL.ts
Convert blurhash to a base64 DataURL string (no canvas or node-canvas)
import { decode } from 'blurhash';
// source of code below https://github.com/wheany/js-png-encoder/blob/master/generatepng.js
const DEFLATE_METHOD = String.fromCharCode(0x78, 0x01);
const CRC_TABLE: number[] = [];
const SIGNATURE = String.fromCharCode(137, 80, 78, 71, 13, 10, 26, 10);
const NO_FILTER = String.fromCharCode(0);
const makeCrcTable = () => {
let c;