Currently, I am utilizing TypeScript with Deno and attempting to incorporate blurhash.
Below is the snippet of code I am working with:
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,);
In this code, width
and height
are predetermined values. However, when executing, I encounter the following error message:
Width and height must match the pixels array
After consulting this issue, it appears that there might be an issue related to the alpha channel. Most of the proposed solutions involve using sharp
in conjunction with ensureAlpha()
. Unfortunately, since sharp
does not run on Deno, I am unable to implement this solution.
If anyone has any insights on how to resolve this issue, I would greatly appreciate your assistance.