1
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4
<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
5
<title>The PIL.Image Module</title>
6
<link rel='stylesheet' href='effbot.css' type='text/css' />
9
<h1>The PIL.Image Module</h1>
11
<dt><a id='PIL.Image.blend-function' name='PIL.Image.blend-function'><b>blend(im1, im2, alpha)</b></a> [<a href='#PIL.Image.blend-function'>#</a>]</dt>
13
<p>Creates a new image by interpolating between two input images, using
17
out = image1 * (1.0 - alpha) + image2 * alpha
35
<dt><a id='PIL.Image.composite-function' name='PIL.Image.composite-function'><b>composite(image1, image2, mask)</b></a> [<a href='#PIL.Image.composite-function'>#</a>]</dt>
38
<dt><i>image1</i></dt>
41
<dt><i>image2</i></dt>
49
<dt><a id='PIL.Image.eval-function' name='PIL.Image.eval-function'><b>eval(image, function)</b></a> [<a href='#PIL.Image.eval-function'>#</a>]</dt>
55
<dt><i>function</i></dt>
63
<dt><a id='PIL.Image.frombuffer-function' name='PIL.Image.frombuffer-function'><b>frombuffer(mode, size, data, decoder_name="raw", *args)</b></a> [<a href='#PIL.Image.frombuffer-function'>#</a>]</dt>
65
<p>(New in 1.1.4) Creates an image memory from pixel data in a string
68
This function is similar to <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a>, but uses data in
69
the byte buffer, where possible. This means that changes to the
70
original buffer object are reflected in this image). Not all modes
71
can share memory; support modes include "L", "RGBX", "RGBA", and
72
"CMYK". For other modes, this function behaves like a corresponding
73
call to the <b>fromstring</b> function.
75
Note that this function decodes pixel data only, not entire images.
76
If you have an entire image file in a string, wrap it in a
77
<b>StringIO</b> object, and use <a class="link" href="#PIL.Image.open-function"><b>open</b></a> to load it.
89
<dt><i>decoder_name</i></dt>
100
<dt><a id='PIL.Image.fromstring-function' name='PIL.Image.fromstring-function'><b>fromstring(mode, size, data, decoder_name="raw", *args)</b></a> [<a href='#PIL.Image.fromstring-function'>#</a>]</dt>
102
<p>Creates an image memory from pixel data in a string.
104
In its simplest form, this function takes three arguments
105
(mode, size, and unpacked pixel data).
107
You can also use any pixel decoder supported by PIL. For more
108
information on available decoders, see the section <a href="pil-decoder.htm"><i>Writing Your Own File Decoder</i></a>.
110
Note that this function decodes pixel data only, not entire images.
111
If you have an entire image in a string, wrap it in a
112
<b>StringIO</b> object, and use <a class="link" href="#PIL.Image.open-function"><b>open</b></a> to load it.
124
<dt><i>decoder_name</i></dt>
127
<dt><i>*args</i></dt>
135
<dt><a id='PIL.Image.getmodebandnames-function' name='PIL.Image.getmodebandnames-function'><b>getmodebandnames(mode)</b></a> [<a href='#PIL.Image.getmodebandnames-function'>#</a>]</dt>
137
<p>Gets a list of individual band names. Given a mode, this function
138
returns a tuple containing the names of individual bands (use
139
<a class="link" href="#PIL.Image.getmodetype-function"><b>getmodetype</b></a> to get the mode used to store each individual
149
<dt>Raises <b>KeyError</b>:</dt><dd>
153
<dt><a id='PIL.Image.getmodebands-function' name='PIL.Image.getmodebands-function'><b>getmodebands(mode)</b></a> [<a href='#PIL.Image.getmodebands-function'>#</a>]</dt>
162
<dt>Raises <b>KeyError</b>:</dt><dd>
166
<dt><a id='PIL.Image.getmodebase-function' name='PIL.Image.getmodebase-function'><b>getmodebase(mode)</b></a> [<a href='#PIL.Image.getmodebase-function'>#</a>]</dt>
175
<dt>Raises <b>KeyError</b>:</dt><dd>
179
<dt><a id='PIL.Image.getmodetype-function' name='PIL.Image.getmodetype-function'><b>getmodetype(mode)</b></a> [<a href='#PIL.Image.getmodetype-function'>#</a>]</dt>
188
<dt>Raises <b>KeyError</b>:</dt><dd>
192
<dt><b>Image()</b> (class) [<a href='#PIL.Image.Image-class'>#</a>]</dt>
194
<p>This class represents an image object.</p>
195
<p>For more information about this class, see <a href='#PIL.Image.Image-class'><i>The Image Class</i></a>.</p>
197
<dt><a id='PIL.Image.init-function' name='PIL.Image.init-function'><b>init()</b></a> [<a href='#PIL.Image.init-function'>#</a>]</dt>
200
<dt><a id='PIL.Image.isDirectory-function' name='PIL.Image.isDirectory-function'><b>isDirectory(f)</b></a> [<a href='#PIL.Image.isDirectory-function'>#</a>]</dt>
203
<dt><a id='PIL.Image.isImageType-function' name='PIL.Image.isImageType-function'><b>isImageType(t)</b></a> [<a href='#PIL.Image.isImageType-function'>#</a>]</dt>
206
<dt><a id='PIL.Image.isStringType-function' name='PIL.Image.isStringType-function'><b>isStringType(t)</b></a> [<a href='#PIL.Image.isStringType-function'>#</a>]</dt>
209
<dt><a id='PIL.Image.isTupleType-function' name='PIL.Image.isTupleType-function'><b>isTupleType(t)</b></a> [<a href='#PIL.Image.isTupleType-function'>#</a>]</dt>
212
<dt><a id='PIL.Image.merge-function' name='PIL.Image.merge-function'><b>merge(mode, bands)</b></a> [<a href='#PIL.Image.merge-function'>#</a>]</dt>
218
<dt><i>bands</i></dt>
226
<dt><a id='PIL.Image.new-function' name='PIL.Image.new-function'><b>new(mode, size, color=0)</b></a> [<a href='#PIL.Image.new-function'>#</a>]</dt>
235
<dt><i>color</i></dt>
243
<dt><a id='PIL.Image.open-function' name='PIL.Image.open-function'><b>open(file, mode="r")</b></a> [<a href='#PIL.Image.open-function'>#</a>]</dt>
245
<p>Opens and identifies the given image file.
247
This is a lazy operation; this function identifies the file, but the
248
actual image data is not read from the file until you try to process
249
the data (or call the <a class="link" href="#PIL.Image.Image.load-method"><b>load</b></a> method).
254
A filename (string) or a file object. The file object
255
must implement <b>read</b>, <b>seek</b>, and <b>tell</b> methods,
256
and be opened in binary mode.
264
<dt>Raises <b>IOError</b>:</dt><dd>
268
<dt><a id='PIL.Image.preinit-function' name='PIL.Image.preinit-function'><b>preinit()</b></a> [<a href='#PIL.Image.preinit-function'>#</a>]</dt>
271
<dt><a id='PIL.Image.register_extension-function' name='PIL.Image.register_extension-function'><b>register_extension(id, extension)</b></a> [<a href='#PIL.Image.register_extension-function'>#</a>]</dt>
277
<dt><i>extension</i></dt>
282
<dt><a id='PIL.Image.register_mime-function' name='PIL.Image.register_mime-function'><b>register_mime(id, mimetype)</b></a> [<a href='#PIL.Image.register_mime-function'>#</a>]</dt>
288
<dt><i>mimetype</i></dt>
293
<dt><a id='PIL.Image.register_open-function' name='PIL.Image.register_open-function'><b>register_open(id, factory, accept=None)</b></a> [<a href='#PIL.Image.register_open-function'>#</a>]</dt>
299
<dt><i>factory</i></dt>
302
<dt><i>accept</i></dt>
307
<dt><a id='PIL.Image.register_save-function' name='PIL.Image.register_save-function'><b>register_save(id, driver)</b></a> [<a href='#PIL.Image.register_save-function'>#</a>]</dt>
313
<dt><i>driver</i></dt>
319
<h2><a id='PIL.Image.Image-class' name='PIL.Image.Image-class'>The Image Class</a></h2>
321
<dt><b>Image()</b> (class) [<a href='#PIL.Image.Image-class'>#</a>]</dt>
324
<dt><a id='PIL.Image.Image.convert-method' name='PIL.Image.Image.convert-method'><b>convert(mode, matrix=None)</b></a> [<a href='#PIL.Image.Image.convert-method'>#</a>]</dt>
326
<p>Returns a converted copy of this image. For the "P" mode, this
327
method translates pixels through the palette. If mode is
328
omitted, a mode is chosen so that all information in the image
329
and the palette can be represented without a palette.
331
The current version supports all possible conversions between
332
"L", "RGB" and "CMYK."
334
When translating a colour image to black and white (mode "L"),
335
the library uses the ITU-R 601-2 luma transform:
337
<b>L = R * 299/1000 + G * 587/1000 + B * 114/1000</b>
339
When translating a greyscale image into a bilevel image (mode
340
"1"), all non-zero values are set to 255 (white). To use other
341
thresholds, use the <a class="link" href="#PIL.Image.Image.point-method"><b>point</b></a> method.
347
<dt><i>matrix</i></dt>
355
<dt><a id='PIL.Image.Image.copy-method' name='PIL.Image.Image.copy-method'><b>copy()</b></a> [<a href='#PIL.Image.Image.copy-method'>#</a>]</dt>
363
<dt><a id='PIL.Image.Image.crop-method' name='PIL.Image.Image.crop-method'><b>crop(box=None)</b></a> [<a href='#PIL.Image.Image.crop-method'>#</a>]</dt>
365
<p>Returns a rectangular region from this image. The box is a
366
4-tuple defining the left, upper, right, and lower pixel
369
This is a lazy operation. Changes to the source image may or
370
may not be reflected in the cropped image. To break the
371
connection, call the <a class="link" href="#PIL.Image.Image.load-method"><b>load</b></a> method on the cropped
383
<dt><a id='PIL.Image.Image.draft-method' name='PIL.Image.Image.draft-method'><b>draft(mode, size)</b></a> [<a href='#PIL.Image.Image.draft-method'>#</a>]</dt>
385
<p>Configures the image file loader so it returns a version of the
386
image that as closely as possible matches the given mode and
387
size. For example, you can use this method to convert a colour
388
JPEG to greyscale while loading it, or to extract a 128x192
389
version from a PCD file.
391
Note that this method modifies the Image object in place. If
392
the image has already been loaded, this method has no effect.
403
<dt><a id='PIL.Image.Image.filter-method' name='PIL.Image.Image.filter-method'><b>filter(filter)</b></a> [<a href='#PIL.Image.Image.filter-method'>#</a>]</dt>
405
<p>Filters this image using the given filter. For a list of
406
available filters, see the <b>ImageFilter</b> module.
409
<dt><i>filter</i></dt>
417
<dt><a id='PIL.Image.Image.fromstring-method' name='PIL.Image.Image.fromstring-method'><b>fromstring(data, decoder_name="raw", *args)</b></a> [<a href='#PIL.Image.Image.fromstring-method'>#</a>]</dt>
419
<p>Loads this image with pixel data from a string.
421
This method is similar to the <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a> function, but
422
loads data into this image instead of creating a new image
425
<dt><a id='PIL.Image.Image.getbands-method' name='PIL.Image.Image.getbands-method'><b>getbands()</b></a> [<a href='#PIL.Image.Image.getbands-method'>#</a>]</dt>
427
<p>Returns a tuple containing the name of each band in this image.
428
For example, <b>getbands</b> on an RGB image returns ("R", "G", "B").
436
<dt><a id='PIL.Image.Image.getbbox-method' name='PIL.Image.Image.getbbox-method'><b>getbbox()</b></a> [<a href='#PIL.Image.Image.getbbox-method'>#</a>]</dt>
444
<dt><a id='PIL.Image.Image.getcolors-method' name='PIL.Image.Image.getcolors-method'><b>getcolors(maxcolors=256)</b></a> [<a href='#PIL.Image.Image.getcolors-method'>#</a>]</dt>
447
<dt><i>maxcolors</i></dt>
455
<dt><a id='PIL.Image.Image.getdata-method' name='PIL.Image.Image.getdata-method'><b>getdata(band=None)</b></a> [<a href='#PIL.Image.Image.getdata-method'>#</a>]</dt>
457
<p>Returns the contents of this image as a sequence object
458
containing pixel values. The sequence object is flattened, so
459
that values for line one follow directly after the values of
460
line zero, and so on.
462
Note that the sequence object returned by this method is an
463
internal PIL data type, which only supports certain sequence
464
operations. To convert it to an ordinary sequence (e.g. for
465
printing), use <b>list(im.getdata())</b>.
476
<dt><a id='PIL.Image.Image.getextrema-method' name='PIL.Image.Image.getextrema-method'><b>getextrema()</b></a> [<a href='#PIL.Image.Image.getextrema-method'>#</a>]</dt>
484
<dt><a id='PIL.Image.Image.getim-method' name='PIL.Image.Image.getim-method'><b>getim()</b></a> [<a href='#PIL.Image.Image.getim-method'>#</a>]</dt>
492
<dt><a id='PIL.Image.Image.getpalette-method' name='PIL.Image.Image.getpalette-method'><b>getpalette()</b></a> [<a href='#PIL.Image.Image.getpalette-method'>#</a>]</dt>
500
<dt><a id='PIL.Image.Image.getpixel-method' name='PIL.Image.Image.getpixel-method'><b>getpixel(xy)</b></a> [<a href='#PIL.Image.Image.getpixel-method'>#</a>]</dt>
511
<dt><a id='PIL.Image.Image.getprojection-method' name='PIL.Image.Image.getprojection-method'><b>getprojection()</b></a> [<a href='#PIL.Image.Image.getprojection-method'>#</a>]</dt>
519
<dt><a id='PIL.Image.Image.histogram-method' name='PIL.Image.Image.histogram-method'><b>histogram(mask=None)</b></a> [<a href='#PIL.Image.Image.histogram-method'>#</a>]</dt>
521
<p>Returns a histogram for the image. The histogram is returned as
522
a list of pixel counts, one for each pixel value in the source
523
image. If the image has more than one band, the histograms for
524
all bands are concatenated (for example, the histogram for an
525
"RGB" image contains 768 values).
527
A bilevel image (mode "1") is treated as a greyscale ("L") image
530
If a mask is provided, the method returns a histogram for those
531
parts of the image where the mask image is non-zero. The mask
532
image must have the same size as the image, and be either a
533
bi-level image (mode "1") or a greyscale image ("L").
544
<dt><a id='PIL.Image.Image.load-method' name='PIL.Image.Image.load-method'><b>load()</b></a> [<a href='#PIL.Image.Image.load-method'>#</a>]</dt>
552
<dt><a id='PIL.Image.Image.offset-method' name='PIL.Image.Image.offset-method'><b>offset(xoffset, yoffset=None)</b></a> [<a href='#PIL.Image.Image.offset-method'>#</a>]</dt>
554
<p>(Deprecated) Returns a copy of the image where the data has been
555
offset by the given distances. Data wraps around the edges. If
556
yoffset is omitted, it is assumed to be equal to xoffset.
558
This method is deprecated. New code should use the <b>offset</b>
559
function in the <b>ImageChops</b> module.
562
<dt><i>xoffset</i></dt>
565
<dt><i>yoffset</i></dt>
573
<dt><a id='PIL.Image.Image.paste-method' name='PIL.Image.Image.paste-method'><b>paste(im, box=None, mask=None)</b></a> [<a href='#PIL.Image.Image.paste-method'>#</a>]</dt>
575
<p>Pastes another image into this image. The box argument is either
576
a 2-tuple giving the upper left corner, a 4-tuple defining the
577
left, upper, right, and lower pixel coordinate, or None (same as
578
(0, 0)). If a 4-tuple is given, the size of the pasted image
579
must match the size of the region.
581
If the modes don't match, the pasted image is converted to the
582
mode of this image (see the <a class="link" href="#PIL.Image.Image.convert-method"><b>convert</b></a> method for
585
Instead of an image, the source can be a integer or tuple
586
containing pixel values. The method then fills the region
587
with the given colour. When creating RGB images, you can
588
also use colour strings as supported by the ImageColor module.
590
If a mask is given, this method updates only the regions
591
indicated by the mask. You can use either "1", "L" or "RGBA"
592
images (in the latter case, the alpha band is used as mask).
593
Where the mask is 255, the given image is copied as is. Where
594
the mask is 0, the current value is preserved. Intermediate
595
values can be used for transparency effects.
597
Note that if you paste an "RGBA" image, the alpha band is
598
ignored. You can work around this by using the same image as
599
both source image and mask.
607
<p>An optional 4-tuple giving the region to paste into.
608
If a 2-tuple is used instead, it's treated as the upper left
609
corner. If omitted or None, the source is pasted into the
612
If an image is given as the second argument and there is no
613
third, the box defaults to (0, 0), and the second argument
614
is interpreted as a mask image.
624
<dt><a id='PIL.Image.Image.point-method' name='PIL.Image.Image.point-method'><b>point(lut, mode=None)</b></a> [<a href='#PIL.Image.Image.point-method'>#</a>]</dt>
638
<dt><a id='PIL.Image.Image.putalpha-method' name='PIL.Image.Image.putalpha-method'><b>putalpha(alpha)</b></a> [<a href='#PIL.Image.Image.putalpha-method'>#</a>]</dt>
646
<dt><a id='PIL.Image.Image.putdata-method' name='PIL.Image.Image.putdata-method'><b>putdata(data, scale=1.0, offset=0.0)</b></a> [<a href='#PIL.Image.Image.putdata-method'>#</a>]</dt>
648
<p>Copies pixel data to this image. This method copies data from a
649
sequence object into the image, starting at the upper left
650
corner (0, 0), and continuing until either the image or the
651
sequence ends. The scale and offset values are used to adjust
652
the sequence values: <b>pixel = value*scale + offset</b>.
658
<dt><i>scale</i></dt>
661
<dt><i>offset</i></dt>
666
<dt><a id='PIL.Image.Image.putpalette-method' name='PIL.Image.Image.putpalette-method'><b>putpalette(data)</b></a> [<a href='#PIL.Image.Image.putpalette-method'>#</a>]</dt>
674
<dt><a id='PIL.Image.Image.putpixel-method' name='PIL.Image.Image.putpixel-method'><b>putpixel(xy, value)</b></a> [<a href='#PIL.Image.Image.putpixel-method'>#</a>]</dt>
676
<p>Modifies the pixel at the given position. The colour is given as
677
a single numerical value for single-band images, and a tuple for
680
Note that this method is relatively slow. For more extensive
681
changes, use <a class="link" href="#PIL.Image.Image.paste-method"><b>paste</b></a> or the <b>ImageDraw</b> module
688
<dt><i>value</i></dt>
693
<dt><a id='PIL.Image.Image.resize-method' name='PIL.Image.Image.resize-method'><b>resize(size, filter=NEAREST)</b></a> [<a href='#PIL.Image.Image.resize-method'>#</a>]</dt>
699
<dt><i>filter</i></dt>
701
An optional resampling filter. This can be
702
one of <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
703
(linear interpolation in a 2x2 environment), <b>BICUBIC</b>
704
(cubic spline interpolation in a 4x4 environment), or
705
<b>ANTIALIAS</b> (a high-quality downsampling filter).
706
If omitted, or if the image has mode "1" or "P", it is
714
<dt><a id='PIL.Image.Image.rotate-method' name='PIL.Image.Image.rotate-method'><b>rotate(angle, filter=NEAREST)</b></a> [<a href='#PIL.Image.Image.rotate-method'>#</a>]</dt>
717
<dt><i>angle</i></dt>
720
<dt><i>filter</i></dt>
722
An optional resampling filter. This can be
723
one of <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
724
(linear interpolation in a 2x2 environment), or <b>BICUBIC</b>
725
(cubic spline interpolation in a 4x4 environment).
726
If omitted, or if the image has mode "1" or "P", it is
734
<dt><a id='PIL.Image.Image.save-method' name='PIL.Image.Image.save-method'><b>save(file, format=None, **options)</b></a> [<a href='#PIL.Image.Image.save-method'>#</a>]</dt>
736
<p>Saves this image under the given filename. If no format is
737
specified, the format to use is determined from the filename
738
extension, if possible.
740
Keyword options can be used to provide additional instructions
741
to the writer. If a writer doesn't recognise an option, it is
742
silently ignored. The available options are described later in
745
You can use a file object instead of a filename. In this case,
746
you must always specify the format. The file object must
747
implement the <b>seek</b>, <b>tell</b>, and <b>write</b>
748
methods, and be opened in binary mode.
754
<dt><i>format</i></dt>
757
<dt><i>**options</i></dt>
763
<dt>Raises <b>KeyError</b>:</dt><dd>
765
<dt>Raises <b>IOError</b>:</dt><dd>
769
<dt><a id='PIL.Image.Image.seek-method' name='PIL.Image.Image.seek-method'><b>seek(frame)</b></a> [<a href='#PIL.Image.Image.seek-method'>#</a>]</dt>
771
<p>Seeks to the given frame in this sequence file. If you seek
772
beyond the end of the sequence, the method raises an
773
<b>EOFError</b> exception. When a sequence file is opened, the
774
library automatically seeks to frame 0.
776
Note that in the current version of the library, most sequence
777
formats only allows you to seek to the next frame.
780
<dt><i>frame</i></dt>
783
<dt>Raises <b>EOFError</b>:</dt><dd>
787
<dt><a id='PIL.Image.Image.show-method' name='PIL.Image.Image.show-method'><b>show(title=None)</b></a> [<a href='#PIL.Image.Image.show-method'>#</a>]</dt>
789
<p>Displays this image. This method is mainly intended for
792
On Unix platforms, this method saves the image to a temporary
793
PPM file, and calls the <b>xv</b> utility.
795
On Windows, it saves the image to a temporary BMP file, and uses
796
the standard BMP display utility to show it (usually Paint).
799
<dt><i>title</i></dt>
804
<dt><a id='PIL.Image.Image.split-method' name='PIL.Image.Image.split-method'><b>split()</b></a> [<a href='#PIL.Image.Image.split-method'>#</a>]</dt>
812
<dt><a id='PIL.Image.Image.tell-method' name='PIL.Image.Image.tell-method'><b>tell()</b></a> [<a href='#PIL.Image.Image.tell-method'>#</a>]</dt>
820
<dt><a id='PIL.Image.Image.thumbnail-method' name='PIL.Image.Image.thumbnail-method'><b>thumbnail(size, resample=NEAREST)</b></a> [<a href='#PIL.Image.Image.thumbnail-method'>#</a>]</dt>
822
<p>Make this image into a thumbnail. This method modifies the
823
image to contain a thumbnail version of itself, no larger than
824
the given size. This method calculates an appropriate thumbnail
825
size to preserve the aspect of the image, calls the <a class="link" href="#PIL.Image.Image.draft-method"><b>draft</b></a> method to configure the file reader (where
826
applicable), and finally resizes the image.
828
Note that the bilinear and bicubic filters in the current
829
version of PIL are not well-suited for thumbnail generation.
830
You should use <b>ANTIALIAS</b> unless speed is much more
831
important than quality.
833
Also note that this function modifies the Image object in place.
834
If you need to use the full resolution image as well, apply this
835
method to a <a class="link" href="#PIL.Image.Image.copy-method"><b>copy</b></a> of the original image.
841
<dt><i>resample</i></dt>
843
Optional resampling filter. This can be one
844
of <b>NEAREST</b>, <b>BILINEAR</b>, <b>BICUBIC</b>, or
845
<b>ANTIALIAS</b> (best quality). If omitted, it defaults
846
to <b>NEAREST</b> (this will be changed to ANTIALIAS in a
854
<dt><a id='PIL.Image.Image.tobitmap-method' name='PIL.Image.Image.tobitmap-method'><b>tobitmap(name="image")</b></a> [<a href='#PIL.Image.Image.tobitmap-method'>#</a>]</dt>
863
<dt>Raises <b>ValueError</b>:</dt><dd>
867
<dt><a id='PIL.Image.Image.tostring-method' name='PIL.Image.Image.tostring-method'><b>tostring(encoder_name="raw", *args)</b></a> [<a href='#PIL.Image.Image.tostring-method'>#</a>]</dt>
870
<dt><i>encoder_name</i></dt>
873
<dt><i>*args</i></dt>
881
<dt><a id='PIL.Image.Image.transform-method' name='PIL.Image.Image.transform-method'><b>transform(size, method, data, resample=NEAREST)</b></a> [<a href='#PIL.Image.Image.transform-method'>#</a>]</dt>
883
<p>Transforms this image. This method creates a new image with the
884
given size, and the same mode as the original, and copies data
885
to the new image using the given transform.
891
<dt><i>method</i></dt>
893
The transformation method. This is one of
894
<b>EXTENT</b> (cut out a rectangular subregion), <b>AFFINE</b>
895
(affine transform), <b>PERSPECTIVE</b> (perspective
896
transform), <b>QUAD</b> (map a quadrilateral to a
897
rectangle), or <b>MESH</b> (map a number of source quadrilaterals
903
<dt><i>resample</i></dt>
905
Optional resampling filter. It can be one of
906
<b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
907
(linear interpolation in a 2x2 environment), or
908
<b>BICUBIC</b> (cubic spline interpolation in a 4x4
909
environment). If omitted, or if the image has mode
910
"1" or "P", it is set to <b>NEAREST</b>.
917
<dt><a id='PIL.Image.Image.transpose-method' name='PIL.Image.Image.transpose-method'><b>transpose(method)</b></a> [<a href='#PIL.Image.Image.transpose-method'>#</a>]</dt>
920
<dt><i>method</i></dt>
922
One of <b>FLIP_LEFT_RIGHT</b>, <b>FLIP_TOP_BOTTOM</b>,
923
<b>ROTATE_90</b>, <b>ROTATE_180</b>, or <b>ROTATE_270</b>.
927
<dt><a id='PIL.Image.Image.verify-method' name='PIL.Image.Image.verify-method'><b>verify()</b></a> [<a href='#PIL.Image.Image.verify-method'>#</a>]</dt>