Hi - I think what you're doing is not uploading a binary image file, but instead you're just uploading the text require("heatshrink").decompress.... into a file. g.drawImage is expecting a binary file.
To write a file like that, all you'd need to do is:
However that's unlikely to work for bigger images as there isn't enough RAM. What I'd suggest is you simply use the image converter built into the IDE, which can upload direct to Storage. There's actually an example of doing exactly that at https://www.espruino.com/Bangle.js+Graphics
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi - I think what you're doing is not uploading a binary image file, but instead you're just uploading the text
require("heatshrink").decompress....
into a file.g.drawImage
is expecting a binary file.To write a file like that, all you'd need to do is:
However that's unlikely to work for bigger images as there isn't enough RAM. What I'd suggest is you simply use the image converter built into the IDE, which can upload direct to Storage. There's actually an example of doing exactly that at https://www.espruino.com/Bangle.js+Graphics