The PIL.ImageDraw Module

Draw(im, mode=None) [#]

A simple 2D drawing interface for PIL images.

im
The image to draw in.
mode
Optional mode to use for color values. For RGB images, this argument can be RGB or RGBA (to blend the drawing into the image). For all other modes, this argument must be the same as the image mode. If omitted, the mode defaults to the mode of the image.

ImageDraw(im, mode=None) (class) [#]

A simple 2D drawing interface for PIL images.

For more information about this class, see The ImageDraw Class.

The ImageDraw Class

ImageDraw(im, mode=None) (class) [#]

A simple 2D drawing interface for PIL images.

Application code should use the Draw factory, instead of directly.

__init__(im, mode=None) [#]

Create a drawing instance.

im
The image to draw in.
mode
Optional mode to use for color values. For RGB images, this argument can be RGB or RGBA (to blend the drawing into the image). For all other modes, this argument must be the same as the image mode. If omitted, the mode defaults to the mode of the image.

arc(xy, start, end, fill=None) [#]

Draw an arc.

bitmap(xy, bitmap, fill=None) [#]

Draw a bitmap.

chord(xy, start, end, fill=None, outline=None) [#]

Draw a chord.

ellipse(xy, fill=None, outline=None) [#]

Draw an ellipse.

getfont() [#]

Get the current default font.

line(xy, fill=None, width=0) [#]

Draw a line, or a connected sequence of line segments.

pieslice(xy, start, end, fill=None, outline=None) [#]

Draw a pieslice.

point(xy, fill=None) [#]

Draw one or more individual pixels.

polygon(xy, fill=None, outline=None) [#]

Draw a polygon.

rectangle(xy, fill=None, outline=None) [#]

Draw a rectangle.

setfill(onoff) [#]

Set the default background color.

setfont(font) [#]

Set the default font.

setink(ink) [#]

Set the default pen color.

shape(shape, fill=None, outline=None) [#]

(Experimental) Draw a shape.

text(xy, text, fill=None, font=None, anchor=None) [#]

Draw text.

textsize(text, font=None) [#]

Get the size of a given string, in pixels.