I am using TypeScript on Deno. I am trying to use blurhash.
This is my code:
const response = await fetch(url);
if (!response.body) {
throw new Error("Body null");
}
const clamped = new Uint8ClampedArray(await response.arrayBuffer());
var blurhash: string = encode(clamped, width, height, 4, 4,);
where width and height is known beforehand. But I get this error:
Width and height must match the pixels array
I read this issue and it seems like the alpha channel is missing or something. The problem is, that all solutions are fixing it by using sharp with ensureAlpha(). But sharp is not running on Deno, so I can't use it.
Does anyone know how I could fix this?
sharpdocumentation ... It can be used with all JavaScript runtimes that provide support for Node-API v9, including Node.js (^18.17.0 or >= 20.3.0), Deno and Bun. - perhaps you're doing it wrongsegmentation fault. But I am in asupabaseenvironment. Maybe that is causing issues.