Greyscale Display w/PIL/tkinter

Fredrik Lundh fredrik at pythonware.com
Sat Sep 8 08:36:13 EDT 2001


Eric Frey wrote:
> I am writing an application where I need to display grayscale images on
> both 8 (pseudocolor) and 24 bit displays. I am using PIL and ImageTk to
> display the images. It works fine on 24 bit displays. However, it doesn't
> work on 8 bit displays since there are only a very small number of gray
> levels. What i would like to happen is for the application to have a
> private colormap that is installed when the cursor is in the window. I
> have used the colormap='new' option to a Frame that fills my root window
> or to a Toplevel widget.

try passing "palette=256" to the PhotoImage constructor.

</F>

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





More information about the Python-list mailing list