pseudocolor visual and colormap for PIL or tk?

Fredrik Lundh effbot at telia.com
Tue Sep 5 19:21:41 CEST 2000


eric frey wrote:
> Is it possible to set up a window to display an image with a pseduocolor visual
> and use an installable colormap? I am trying to display grayscale images
> on an 8 bit display and the default TrueColor visual results in a limited
> number of gray values so the images look posterized.

here are a few things to try:

    # use a custom colormap for this window
    mywindow = Toplevel(colormap="new")

    # use a grayscale visual for this window
    # (not all X servers support mixed visuals)
    mywindow = Toplevel(visual="grayscale 8")

    # display this image using 256 levels of gray
    image = PhotoImage(..., palette=256)

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->




More information about the Python-list mailing list