[Image-SIG] define color for imagem from matrix.
Jim Tittsler
jwt at onjapan.net
Tue Aug 4 07:26:13 CEST 2009
On 2009-07-30 05:09, Milton Cezar Ribeiro wrote:
> a = numpy.array(landscape_matrix)
> i = Image.fromarray(a)
> i.show()
>
> But now I need to define a color table like
> #index of color, R, G, B
> 0 255 255 255
> 1 127 127 0
> 2 127 0 127
> 3 255 0 0
> 4 0 255 0
>
> How can I assign this color table to my image?
If you create a "P" type image, you can use the putpalette() method to
attach your desired color table.
http://pythonware.com/library/pil/handbook/image.htm
More information about the Image-SIG
mailing list