Page 33      All Pages  All Books
The ImageDraw Module
The ImageDraw module provide basic graphics support for Image objects. It can for example be used to create new images, annotate or retouch existing images, and to generate graphics on the fly for web use.
Example
Example: Draw a Grey Cross Over an Image
import Image, ImageDraw
im = Image.open("lena.pgm")
draw = ImageDraw.Draw(im) draw.line((0, 0) + im.size, fill=128) draw.line((0, im.size[1], im.size[0], 0), fill=128) del draw
# write to stdout im.save(sys.stdout, "PNG")
Functions
Draw
Draw(image) => Draw instance
Creates an object that can be used to draw in the given image. Note that the image will be modified in place.
Methods
arc
draw.arc(xy, start, end, options)
Draws an arc (a portion of a circle outline) between the start and end angles, inside the given bounding box.
The outline option gives the colour to use for the arc.

Page 33      All Pages  All Books