pseudocolor visual and colormap for PIL or tk? 
Author Message
 pseudocolor visual and colormap for PIL or tk?

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. What I would like is to
set up a colormap, allocate the number of grayscale values I need, and then install the colormap when my window is active. I know this will make the other
windows look ugly, but I don't mind. I have done this in C before, but am
wondering if there is a way to do it in Tkinter and python on UNIX. Thanks.

--
=======================================================================
Eric C. Frey  
Assistant Professor
Department of Biomedical Engineering and Department of Radiology
The University of North Carolina



Sat, 22 Feb 2003 20:29:08 GMT  
 pseudocolor visual and colormap for PIL or tk?

Quote:

> 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
-->



Sun, 23 Feb 2003 01:21:41 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Non-default Colormap or visual

2. 24 bit colormap to 8 bit colormap

3. How to solve nasty Tkinter/Tk colormap problem?

4. colormap usage by tck / tk

5. Colormap difficulties in Tk 4.1 - Help?

6. Private colormap in Tk 8.0

7. tk colormap resources

8. Tk 8.0p2 private colormap bug?

9. Tk Colormap

10. TK and X Colormap

11. running Tcl/Tk program under X, no more colors left in colormap

12. Tcl/Tk colormap

 

 
Powered by phpBB® Forum Software