Module PIL.ImageDraw

Module Summary:

class Draw:
    def __init__(self)
A simple 2D drawing interface for PIL images.
class ImageDraw:
    def __init__(self, im, mode=None)
A simple 2D drawing interface for PIL images.

Classes

The Draw Class

Draw()

A simple 2D drawing interface for PIL images.

Note that Draw and ImageDraw are two names for the same class. New code should use Draw.

The ImageDraw Class

ImageDraw()

A simple 2D drawing interface for PIL images.

Note that Draw and ImageDraw are two names for the same class. New code should use Draw.

Constructor:

ImageDraw(im, mode=None)

Create a drawing instance.

Parameters:

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.

Method Summary:

arc(xy, start, end, fill=None)
Draw an arc.
arc(xy, start, end, fill=None)
Draw an arc.
bitmap(xy, bitmap, fill=None)
Draw a bitmap.
bitmap(xy, bitmap, fill=None)
Draw a bitmap.
chord(xy, start, end, fill=None, outline=None)
Draw a chord.
chord(xy, start, end, fill=None, outline=None)
Draw a chord.
ellipse(xy, fill=None, outline=None)
Draw an ellipse.
ellipse(xy, fill=None, outline=None)
Draw an ellipse.
getfont()
Get the current default font.
getfont()
Get the current default font.
line(xy, fill=None)
Draw a line, or a connected sequence of line segments.
line(xy, fill=None)
Draw a line, or a connected sequence of line segments.
pieslice(xy, start, end, fill=None, outline=None)
Draw a pieslice.
pieslice(xy, start, end, fill=None, outline=None)
Draw a pieslice.
point(xy, fill=None)
Draw one or more individual pixels.
point(xy, fill=None)
Draw one or more individual pixels.
polygon(xy, fill=None, outline=None)
Draw a polygon.
polygon(xy, fill=None, outline=None)
Draw a polygon.
rectangle(xy, fill=None, outline=None)
Draw a rectangle.
rectangle(xy, fill=None, outline=None)
Draw a rectangle.
setfill(onoff)
Set the default background color.
setfill(onoff)
Set the default background color.
setfont(font)
Set the default font.
setfont(font)
Set the default font.
setink(ink)
Set the default pen color.
setink(ink)
Set the default pen color.
shape(shape, fill=None, outline=None)
(Experimental) Draw a shape.
shape(shape, fill=None, outline=None)
(Experimental) Draw a shape.
text(xy, text, fill=None, font=None, anchor=None)
Draw text.
text(xy, text, fill=None, font=None, anchor=None)
Draw text.
textsize(text, font=None)
Get the size of a given string, in pixels.
textsize(text, font=None)
Get the size of a given string, in pixels.

arc

arc(xy, start, end, fill=None)

Draw an arc.

arc

arc(xy, start, end, fill=None)

Draw an arc.

bitmap

bitmap(xy, bitmap, fill=None)

Draw a bitmap.

bitmap

bitmap(xy, bitmap, fill=None)

Draw a bitmap.

chord

chord(xy, start, end, fill=None, outline=None)

Draw a chord.

chord

chord(xy, start, end, fill=None, outline=None)

Draw a chord.

ellipse

ellipse(xy, fill=None, outline=None)

Draw an ellipse.

ellipse

ellipse(xy, fill=None, outline=None)

Draw an ellipse.

getfont

getfont()

Get the current default font.

getfont

getfont()

Get the current default font.

line

line(xy, fill=None)

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

line

line(xy, fill=None)

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

pieslice

pieslice(xy, start, end, fill=None, outline=None)

Draw a pieslice.

pieslice

pieslice(xy, start, end, fill=None, outline=None)

Draw a pieslice.

point

point(xy, fill=None)

Draw one or more individual pixels.

point

point(xy, fill=None)

Draw one or more individual pixels.

polygon

polygon(xy, fill=None, outline=None)

Draw a polygon.

polygon

polygon(xy, fill=None, outline=None)

Draw a polygon.

rectangle

rectangle(xy, fill=None, outline=None)

Draw a rectangle.

rectangle

rectangle(xy, fill=None, outline=None)

Draw a rectangle.

setfill

setfill(onoff)

Set the default background color.

setfill

setfill(onoff)

Set the default background color.

setfont

setfont(font)

Set the default font.

setfont

setfont(font)

Set the default font.

setink

setink(ink)

Set the default pen color.

setink

setink(ink)

Set the default pen color.

shape

shape(shape, fill=None, outline=None)

(Experimental) Draw a shape.

shape

shape(shape, fill=None, outline=None)

(Experimental) Draw a shape.

text

text(xy, text, fill=None, font=None, anchor=None)

Draw text.

text

text(xy, text, fill=None, font=None, anchor=None)

Draw text.

textsize

textsize(text, font=None)

Get the size of a given string, in pixels.

textsize

textsize(text, font=None)

Get the size of a given string, in pixels.