Page 1 of 1

Drawing image from array values

Posted: Sat May 28, 2016 4:30 am
by matt7
I have looked through the documentation and cannot find a quick way to convert an array of values to an image.

Let's say I have a 3-dimensional array sized N x M x 3. N x M is the size of my image in pixels, and I have three layers which contain R, G, and B values. (Or maybe I want to include a fourth layer with alpha values, or maybe only one layer for a black and white image.)

Currently I am looping through i (0 to N-1) and j (0 to M-1) values and drawing each pixel which is very time consuming. Is there a faster or simpler way to draw the image using data in this format that I'm missing?

Re: Drawing image from array values

Posted: Sat May 28, 2016 5:41 am
by Mr. Kibernetik
No, currently smart BASIC cannot work with raw bitmaps.
Depending on what kind of bitmap data you have, you can yourself create for example BMP image file (which is basically a raw bitmap) from your data and then draw it.

Re: Drawing image from array values

Posted: Sat May 28, 2016 2:11 pm
by matt7
Ah, ok I will look into that. Thank you!