[Image-SIG] define color for imagem from matrix.

Milton Cezar Ribeiro miltinho.astronauta at gmail.com
Wed Jul 29 19:09:46 CEST 2009


Dear all,

I read a matrix (with values from 0 to 4), converted it to image and showed
it using:

    landscape_matrix=[[1, 2, 0, 1, 0], [1, 0, 1, 2, 0], [1, 1, 4, 2, 1], [1,
0, 3, 2, 2]]

    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?

Bests

milton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090729/160f56ff/attachment.htm>


More information about the Image-SIG mailing list