The Python Imaging Library
  Copyright © 1997 by Fredrik Lundh <fredrik@pythonware.com>  
  Updated 17 Aug 1997  

< The ImageFont Module | The ImageTk Module | The ImageWin Module >

The ImageTk Module

This module contains support to create and modify Tkinter BitmapImage and PhotoImage objects.

For examples, see the various demo programs in the Scripts directory.

The BitmapImage Class

BitmapImage (constructor)

BitmapImage( image, options ). Create a bitmap image object, which can be used everywhere Tkinter expects an image object.

The given image must have mode "1". Pixels having value 0 are treated as transparent. Options, if any, are passed to Tkinter. The most commonly used option is foreground, which is used to specify the colour for the non-transparent parts. See the Tkinter documentation for information on how to specify colours.

The PhotoImage Class

PhotoImage (constructor)

PhotoImage( image ) creates a Tkinter-compatible photo image, which can be used everywhere Tkinter expects an image object. If the image is an RGBA image, pixels having alpha 0 are treated as transparent.

PhotoImage( mode, size ) creates an empty (transparent) photo image object. Use paste to copy image data to this object.

paste

paste( image, box ) pastes an image into the photo image. The box is a 4-tuple defining the left, upper, right, and lower pixel coordinate. If the box is omitted, or None, all of the image is assumed. In any case, the size of the pasted image must match the size of the region. If the image mode does not match the photo image mode, conversions are automatically applied.

< The ImageFont Module | The ImageTk Module | The ImageWin Module >