-
• #2
I'd say it depends a bit on the actual size/style of the image. Given the image you've got there, I'd basically go with Option 1.
- Save the image with the image converter as 1bpp, image string, compressed
- Save it into a function that is executed when you need the image data: https://www.espruino.com/Code+Style#other-suggestions
- Render with
g.setColor("#3d9ae2").drawImage(img)
Since I imagine your code is saved to flash and executed from there, the data will be streamed out as required, taking up no RAM unless needed.
IMO the SVG approach makes sense when you have a big vector image - for smaller things Bitmap will win out. Also while the SVG converter is doing a great job of extracting the actual data, how it's represented in Espruino could really be improved!
I could imagine that something like:
g.setColor("#3d9ae2"); [ [61,8,...],[...],[...] ].forEach(x=>g.fillPoly.bind(g))
would really help.
- Save the image with the image converter as 1bpp, image string, compressed
-
• #3
I understand it now. Just a quick question..
How can u save a single function in flash? Write a module??? Or in bootcde bootrst file?
-
• #4
Writing a module is probably the easiest - however if you save a function to a file in Storage you can just do
eval(require("Storage").read("myfunction"))
and that'll work too
Hi,
I have 4 diffetent types of image data. 3 of them are in SVG format and one is in bitmap. I have converted SVG->BangleJS using this, and Bitmap->BangleJS using this
1- Bitmap
2- SVG - Int Array
2- SVG Float32 array
3- Regular Array
My question is, what would be the best option to save RAM considering I am storing the image data in files and reading then using Storage module. I know that option 1 is not the best one but I just listed because I have it.
I am getting the best rendering output when using Option 1 or 2