Image Manipulation

Simple image manipulation is done through the Pixmap class. A Pixmap object allows pixel-level access to an image. Pixmaps allow for saving to a file and may be displayed using an Image object.

Pixmap(filename)
Constructs a Pixmap from the image file, filename. See Image for supported file types.

Pixmap(width, height)
Constructs a Pixmap of the given height and width. Initially, all pixels will be transparent.

getWidth()
Returns the width of the image in pixels.

getHeight()
Returns the height of the image in pixels.

getPixel(x,y)
Returns a triple (r,g,b) of the red, green, and blue intensities of the pixel at (x,y). Intensity values are in range(256).

setPixel(x,y,color)
Color is a triple (r,g,b) representing a color for the pixel. Sets pixel at (x,y) to the given color.

save(filename)
Saves the image in a file having the given name. The format for the file is determined by the extension on the filename (e.g. .ppm or .gif).

clone()
Returns a copy of the Pixmap.



John Zelle 2005-06-04