Generating code from Static Patterns

For basic image to code, something that could take an image and spit out some code to put the data in an array, perhaps with some getPixel() APIs would be a good start. This could be done entirely outside of PB, even just in the browser. Browsers can decode all kinds of images and draw them in canvases, and then give you pixel data from the canvas (though sometimes color correction changes things in unexpected ways).

See

and

Now if we had a canvas API and a way to load PNG files as sprites (or sprite sheets) then an embedded PNG decoder would be handy. Note that in any event all of the decompressed image data still has to sit in RAM for things to be performant.

1 Like

Yeah, the usefulness in firmware does depends on a canvas API.

I’m hopeful we can port at least a decent chunk of it into usercode first. Between webgl and that, so many existing bits of JS would become doable easily.