[Image-SIG] displaying PIL image with a palette

Bob Klimek robert.klimek@grc.nasa.gov
Wed, 05 Apr 2000 15:19:56 -0400


Yesterday I posted a message asking if anybody knows how to display a
PIL image of type "P" (with a palette) using wxPython. I've got no
replys but I got it working another way - producing a 24-bit pseudocolor
image as output. For anyone interested here it is:

Convert the 8-bit image to 24-bit image (img = im.convert("RGB")). Then
just call the point function as (out = img.point(palette)) where palette
is a list of 256 red, 256 green, and 256 blue values. out is a 24-bit
color (pseudocolor) image which can now be displayed in wxPython (after
a conversion using SetData)

Bob
-- 
---------------------
Robert B. Klimek
NASA Glenn Research Center
robert.klimek@grc.nasa.gov
---------------------