Recent twts in reply to #a4xeswq

#Python #numpy #imageProcessing I have done this before but I can’t remember how and I’m lazy:

Say you have a table/dict of ints to colors like this palette = {
1: rgb(100, 0, 200),
2: rgb(200, 100, 0),
3: rgb(0, 200, 100),

it could be just an array of tuples or a 2D array maybe… [[100, 0, 200)], [200, 100, 0], …]

And I have another 2D array of ints that I want to convert to a stack of RGB arrays so as to make an image of them (with #Pillow, or in my case #py5)

Which would be an elegant way of doing it?

(Writing this I had an idea, but I have to get out to my weekend shift at Sesc… maybe I’ll try it later)

cc @TomLarrow@TomLarrow

⤋ Read More


Login to join in on this yarn.