Drawing image from array values
Posted: Sat May 28, 2016 4:30 am
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?
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?