/usr/share/doc/python-imaging/html/imagedraw.htm is in python-imaging-doc-html 1.1.2-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <html><head><title>The ImageDraw Module</title><link rel="stylesheet" type="text/css" href="effbot.css" /></head><body><div id="IMAGEDRAW-MODULE" class="chapter"><h1 style="chapter">The ImageDraw Module</h1><p>This module provide basic graphics support for
<tt>Image</tt> 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.</p><div class="sect1"><h2 style="sect1">Example</h2><div class="example"><b style="example">Example: Draw a Grey Cross Over an Image</b><pre>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")</pre></div></div><div class="sect1"><h2 style="sect1">Functions</h2><div id="IMAGEDRAW-DRAW" class="sect2"><h3 style="sect2">Draw (constructor)</h3><p><tt>Draw(image)</tt> creates an object that can be
used to draw in the given image.</p><p>Note that the image will be modified in place.</p></div></div><div class="sect1"><h2 style="sect1">Methods</h2><div id="IMAGEDRAW-ARC-METHOD" class="sect2"><h3 style="sect2">arc</h3><p><tt>arc(xy, start, end, options)</tt>. Draws an arc (a
circle outline segment) between the start and end angles, inside the
given bounding box.</p><p>The <tt>outline</tt> option gives the colour to use for
the arc.</p></div><div id="IMAGEDRAW-BITMAP-METHOD" class="sect2"><h3 style="sect2">bitmap</h3><p><tt>bitmap(xy, bitmap, options)</tt>. Draws a bitmap
at the given position, using the current fill colour.</p></div><div id="IMAGEDRAW-CHORD-METHOD" class="sect2"><h3 style="sect2">chord</h3><p><tt>chord(xy, start, end, options)</tt>. Same as
<tt>arc</tt>, but connects the end points with a straight
line. </p><p>The <tt>outline</tt> option gives the colour to use
for the chord outline. The <tt>fill</tt> option gives the
colour to use for the chord interior.</p></div><div id="IMAGEDRAW-ELLIPSE-METHOD" class="sect2"><h3 style="sect2">ellipse</h3><p><tt>ellipse(xy, options)</tt>. Draws an ellipse inside the
given bounding box.</p><p>The <tt>outline</tt> option gives the colour to use
for the ellipse outline. The <tt>fill</tt> option gives
the colour to use for the ellipse interior.</p></div><div id="IMAGEDRAW-LINE-METHOD" class="sect2"><h3 style="sect2">line</h3><p><tt>line(xy, options)</tt> draws a line between the
coordinates in the <tt>xy</tt> list.</p><p>The coordinate list can be any sequence object containing either
2-tuples [ (<tt>x, y</tt>), ... ] or numeric values [
<tt>x</tt>, <tt>y</tt>, ... ]. It should contain
at least two coordinates.</p><p>The <tt>fill</tt> option gives the colour to use for
the line.</p></div><div id="IMAGEDRAW-PIESLICE-METHOD" class="sect2"><h3 style="sect2">pieslice</h3><p><tt>pieslice(xy, start, end, options)</tt>. Same as
<tt>arc</tt>, but also draws straight lines between the
end points and the center of the bounding box.</p><p>The <tt>outline</tt> option gives the colour to use
for the pieslice outline. The <tt>fill</tt> option gives
the colour to use for the pieslice interior.</p></div><div id="IMAGEDRAW-POINT-METHOD" class="sect2"><h3 style="sect2">point</h3><p><tt>point(xy, options)</tt> draws points (individual
pixels) at the given coordinates.</p><p>The coordinate list can be any sequence object containing either
2-tuples [ (<tt>x, y</tt>), ... ] or numeric values [
<tt>x</tt>, <tt>y</tt>, ... ].</p><p>The <tt>fill</tt> option gives the colour to use for the
points.</p></div><div id="IMAGEDRAW-POLYGON-METHOD" class="sect2"><h3 style="sect2">polygon</h3><p><tt>polygon(xy, options)</tt> draws a polygon.</p><p>The polygon outline consists of straight lines between the given
coordinates, plus a straight line between the last and the first
coordinate.</p><p>The coordinate list can be any sequence object containing either
2-tuples [ (<tt>x, y</tt>), ... ] or numeric values [
<tt>x</tt>, <tt>y</tt>, ... ]. It should contain
at least three coordinates.</p><p>The <tt>outline</tt> option gives the colour to use
for the polygon outline. The <tt>fill</tt> option gives
the colour to use for the polygon interior.</p></div><div id="IMAGEDRAW-RECTANGLE-METHOD" class="sect2"><h3 style="sect2">rectangle</h3><p><tt>rectangle(box, options)</tt> draws a
rectangle.</p><p>The box can be any sequence object containing either 2-tuples [
(<tt>x, y</tt>), (<tt>x, y</tt>) ] or numeric
values [ <tt>x</tt>, <tt>y</tt>,
<tt>x</tt>, <tt>y</tt> ]. It should contain
exactly two coordinates.</p><p>Note that the second coordinate pair defines a point just
outside the rectangle, also when the rectangle is not filled.</p><p>The <tt>outline</tt> option gives the colour to use
for the rectangle outline. The <tt>fill</tt> option gives
the colour to use for the rectangle interior.</p></div><div id="IMAGEDRAW-TEXT-METHOD" class="sect2"><h3 style="sect2">text</h3><p><tt>text(position, string, options)</tt> draws the
string at the given position.</p><p>The <tt>font</tt> option is used to specify what font to
use. It should be an instance of the <tt>ImageFont</tt>
class, typically loaded from file using the <tt>load</tt>
method in the <tt>ImageFont</tt> module.</p><p>The <tt>fill</tt> option gives the colour to use for the
text.</p></div><div id="IMAGEDRAW-TEXTSIZE-METHOD" class="sect2"><h3 style="sect2">textsize</h3><p><tt>textsize(string, options) ⇒ (width,
height)</tt> return the size of the given string.</p><p>The <tt>font</tt> option is used to specify what font to
use. It should be an instance of the <tt>ImageFont</tt>
class, typically loaded from file using the <tt>load</tt>
method in the <tt>ImageFont</tt> module.</p></div></div><div class="sect1"><h2 style="sect1">Compatibility</h2><p>The <tt>Draw</tt> class contains a constructor and
a number of methods which are provided for backwards compatibility
only. For this to work properly, you should
<i>either</i> use options on the drawing primitives, or
these methods. Do not mix the old and new calling conventions.</p><div class="sect2"><h3 style="sect2">ImageDraw (constructor)</h3><p><tt>ImageDraw(image)</tt>. Same as
<tt>Draw</tt>. Don't use this name in new code.</p></div><div id="IMAGEDRAW-SETINK-METHOD" class="sect2"><h3 style="sect2">setink</h3><p><tt>setink(ink)</tt> sets the color to use for
subsequent draw and fill operations.</p></div><div id="IMAGEDRAW-SETFILL-METHOD" class="sect2"><h3 style="sect2">setfill</h3><p><tt>setfill(mode)</tt> sets the fill mode.</p><p>If the mode is 0, subsequently drawn shapes (like polygons and
rectangles) are outlined. If the mode is 1, they are filled.</p></div><div id="IMAGEDRAW-SETFONT-METHOD" class="sect2"><h3 style="sect2">setfont</h3><p><tt>setfont(font)</tt> sets the default font to use
for the <tt>text</tt> method.</p><p>The <tt>font</tt> argument should be an instance of
the <tt>ImageFont</tt> class, typically loaded from file
using the <tt>load</tt> method in the
<tt>ImageFont</tt> module.</p></div></div></div></body></html>
|