Closed velara3 closed 1 year ago
what is "data" in your case? It should be an ArrayBuffer, not a Uint8Array. Could you start with a code in our README, and gradually modify it to what you need?
I changed from this:
var png = UPNG.encode([data], width, height, 0);
to this:
var png = UPNG.encode([data.buffer], width, height, 0);
And now it works. Thank you
I have a library that extracts an image into pixel data. Is there example code that shows how to create a png file?
Here is the data property:
Exported image:
Another example:
The image is the correct size but also blank.
If I remove the buffer line as shown in the code below I get an error from
writeFile
: