Source

pilgui / pythondoc-PIL.Image.xml

Full commit
<module filename="C:\PROGRAM FILES\PYTHON27\lib\site-packages\PIL\Image.py" name="PIL.Image"><class lineno="34" name="PIL.Image._imaging_not_installed"><info><def>_imaging_not_installed</def><name>_imaging_not_installed</name></info><method lineno="36" name="PIL.Image._imaging_not_installed.__getattr__"><info><def>__getattr__(id)</def><name>__getattr__</name></info></method></class><function lineno="83" name="PIL.Image.isStringType"><info><def>isStringType(t)</def><name>isStringType</name><summary>(Internal) Checks if an object is a string.</summary><description>(Internal) Checks if an object is a string.  If the current
Python version supports Unicode, this checks for both 8-bit
and Unicode strings.</description></info></function><function lineno="86" name="PIL.Image.isStringType"><info><def>isStringType(t)</def><name>isStringType</name></info></function><function lineno="92" name="PIL.Image.isTupleType"><info><def>isTupleType(t)</def><name>isTupleType</name><summary>(Internal) Checks if an object is a tuple.</summary><description>(Internal) Checks if an object is a tuple.</description></info></function><function lineno="98" name="PIL.Image.isImageType"><info><def>isImageType(t)</def><name>isImageType</name><summary>(Internal) Checks if an object is an image object.</summary><description>(Internal) Checks if an object is an image object.</description></info></function><function lineno="105" name="PIL.Image.isDirectory"><info><def>isDirectory(f)</def><name>isDirectory</name><summary>(Internal) Checks if an object is a string, and that it points to a
directory.</summary><description>(Internal) Checks if an object is a string, and that it points to a
directory.</description></info></function><function lineno="219" name="PIL.Image._conv_type_shape"><info><def>_conv_type_shape(im)</def><name>_conv_type_shape</name></info></function><function lineno="244" name="PIL.Image.getmodebase"><info><def>getmodebase(mode)</def><name>getmodebase</name><summary>Gets the "base" mode for given mode.</summary><description>Gets the "base" mode for given mode.  This function returns "L" for
images that contain grayscale data, and "RGB" for images that
contain color data.</description><param name="mode">Input mode.</param><return>"L" or "RGB".</return><exception name="KeyError">If the input mode was not a standard mode.</exception></info></function><function lineno="255" name="PIL.Image.getmodetype"><info><def>getmodetype(mode)</def><name>getmodetype</name><summary>Gets the storage type mode.</summary><description>Gets the storage type mode.  Given a mode, this function returns a
single-layer mode suitable for storing individual bands.</description><param name="mode">Input mode.</param><return>"L", "I", or "F".</return><exception name="KeyError">If the input mode was not a standard mode.</exception></info></function><function lineno="269" name="PIL.Image.getmodebandnames"><info><def>getmodebandnames(mode)</def><name>getmodebandnames</name><summary>Gets a list of individual band names.</summary><description><p>Gets a list of individual band names.  Given a mode, this function
returns a tuple containing the names of individual bands (use
<a class="link" href="#PIL.Image.getmodetype-function"><b>getmodetype</b></a> to get the mode used to store each individual
band.

</p></description><param name="mode">Input mode.</param><return>A tuple containing band names.  The length of the tuple
    gives the number of bands in an image of the given mode.</return><exception name="KeyError">If the input mode was not a standard mode.</exception></info></function><function lineno="279" name="PIL.Image.getmodebands"><info><def>getmodebands(mode)</def><name>getmodebands</name><summary>Gets the number of individual bands for this mode.</summary><description>Gets the number of individual bands for this mode.</description><param name="mode">Input mode.</param><return>The number of bands in this mode.</return><exception name="KeyError">If the input mode was not a standard mode.</exception></info></function><function lineno="290" name="PIL.Image.preinit"><info><def>preinit()</def><name>preinit</name><summary>Explicitly loads standard file format drivers.</summary><description>Explicitly loads standard file format drivers.</description><docstring>Load standard file format drivers.</docstring></info></function><function lineno="328" name="PIL.Image.init"><info><def>init()</def><name>init</name><summary>Explicitly initializes the Python Imaging Library.</summary><description>Explicitly initializes the Python Imaging Library.  This function
loads all available file format drivers.</description><docstring>Load all file format drivers.</docstring></info></function><function lineno="371" name="PIL.Image._getdecoder"><info><def>_getdecoder(mode, decoder_name, args, extra=())</def><name>_getdecoder</name></info></function><function lineno="387" name="PIL.Image._getencoder"><info><def>_getencoder(mode, encoder_name, args, extra=())</def><name>_getencoder</name></info></function><class lineno="407" name="PIL.Image._E"><info><def>_E</def><name>_E</name></info><method lineno="408" name="PIL.Image._E.__init__"><info><def>__init__(data)</def><name>__init__</name></info></method><method lineno="409" name="PIL.Image._E.__coerce__"><info><def>__coerce__(other)</def><name>__coerce__</name></info></method><method lineno="410" name="PIL.Image._E.__add__"><info><def>__add__(other)</def><name>__add__</name></info></method><method lineno="411" name="PIL.Image._E.__mul__"><info><def>__mul__(other)</def><name>__mul__</name></info></method></class><function lineno="413" name="PIL.Image._getscaleoffset"><info><def>_getscaleoffset(expr)</def><name>_getscaleoffset</name></info></function><class lineno="444" name="PIL.Image.Image"><info><def>Image</def><name>Image</name><summary>This class represents an image object.</summary><description>This class represents an image object.  To create Image objects, use
the appropriate factory functions.  There's hardly ever any reason
to call the Image constructor directly.</description><see>#open</see><see>#new</see><see>#fromstring</see></info><method lineno="449" name="PIL.Image.Image.__init__"><info><def>__init__()</def><name>__init__</name></info></method><method lineno="460" name="PIL.Image.Image._new"><info><def>_new(im)</def><name>_new</name></info></method><method lineno="479" name="PIL.Image.Image._copy"><info><def>_copy()</def><name>_copy</name></info></method><method lineno="484" name="PIL.Image.Image._dump"><info><def>_dump(file=None, format=None)</def><name>_dump</name></info></method><method lineno="496" name="PIL.Image.Image.__repr__"><info><def>__repr__()</def><name>__repr__</name></info></method><method lineno="503" name="PIL.Image.Image.__getattr__"><info><def>__getattr__(name)</def><name>__getattr__</name></info></method><method lineno="522" name="PIL.Image.Image.tostring"><info><def>tostring(encoder_name="raw", *args)</def><name>tostring</name><summary>Returns a string containing pixel data.</summary><description>Returns a string containing pixel data.</description><param name="encoder_name">What encoder to use.  The default is to
   use the standard "raw" encoder.</param><param name="*args">Extra arguments to the encoder.</param><return>An 8-bit string.</return><docstring>Return image as a binary string</docstring></info></method><method lineno="559" name="PIL.Image.Image.tobitmap"><info><def>tobitmap(name="image")</def><name>tobitmap</name><summary>Returns the image converted to an X11 bitmap.</summary><description>Returns the image converted to an X11 bitmap.  This method
only works for mode "1" images.</description><param name="name">The name prefix to use for the bitmap variables.</param><return>A string containing an X11 bitmap.</return><exception name="ValueError">If the mode is not "1"</exception><docstring>Return image as an XBM bitmap</docstring></info></method><method lineno="577" name="PIL.Image.Image.fromstring"><info><def>fromstring(data, decoder_name="raw", *args)</def><name>fromstring</name><summary>Loads this image with pixel data from a string.</summary><description><p>Loads this image with pixel data from a string.
</p><p>
This method is similar to the <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a> function, but
loads data into this image instead of creating a new image
object.
</p></description><docstring>Load data to image from binary string</docstring></info></method><method lineno="606" name="PIL.Image.Image.load"><info><def>load()</def><name>load</name><summary>Allocates storage for the image and loads the pixel data.</summary><description>Allocates storage for the image and loads the pixel data.  In
normal cases, you don't need to call this method, since the
Image class automatically loads an opened image when it is
accessed for the first time.</description><return>An image access object.</return><docstring>Explicitly load pixel data.</docstring></info></method><method lineno="628" name="PIL.Image.Image.verify"><info><def>verify()</def><name>verify</name><summary>Verifies the contents of a file.</summary><description>Verifies the contents of a file. For data read from a file, this
method attempts to determine if the file is broken, without
actually decoding the image data.  If this method finds any
problems, it raises suitable exceptions.  If you need to load
the image after using this method, you must reopen the image
file.</description><docstring>Verify file contents.</docstring></info></method><method lineno="664" name="PIL.Image.Image.convert"><info><name>convert</name><summary>Returns a converted copy of this image.</summary><description><p>Returns a converted copy of this image. For the "P" mode, this
method translates pixels through the palette.  If mode is
omitted, a mode is chosen so that all information in the image
and the palette can be represented without a palette.
</p><p>
The current version supports all possible conversions between
"L", "RGB" and "CMYK."
</p><p>
When translating a colour image to black and white (mode "L"),
the library uses the ITU-R 601-2 luma transform:
</p><p>
<b>L = R * 299/1000 + G * 587/1000 + B * 114/1000</b>
</p><p>
When translating a greyscale image into a bilevel image (mode
"1"), all non-zero values are set to 255 (white). To use other
thresholds, use the <a class="link" href="#PIL.Image.Image.point-method"><b>point</b></a> method.

</p></description><def>convert(mode, matrix=None, **options)</def><param name="mode">The requested mode.</param><param name="matrix">An optional conversion matrix.  If given, this
   should be 4- or 16-tuple containing floating point values.</param><param name="options">Additional options, given as keyword arguments.</param><keyparam name="dither">Dithering method, used when converting from
   mode "RGB" to "P".
   Available methods are NONE or FLOYDSTEINBERG (default).</keyparam><keyparam name="palette">Palette to use when converting from mode "RGB"
   to "P".  Available palettes are WEB or ADAPTIVE.</keyparam><keyparam name="colors">Number of colors to use for the ADAPTIVE palette.
   Defaults to 256.</keyparam><return>An Image object.</return><docstring>Convert to other pixel format</docstring></info></method><method lineno="708" name="PIL.Image.Image.quantize"><info><def>quantize(colors=256, method=0, kmeans=0, palette=None)</def><name>quantize</name></info></method><method lineno="740" name="PIL.Image.Image.copy"><info><def>copy()</def><name>copy</name><summary>Copies this image.</summary><description>Copies this image. Use this method if you wish to paste things
into an image, but still retain the original.</description><return>An Image object.</return><docstring>Copy raster data</docstring></info></method><method lineno="760" name="PIL.Image.Image.crop"><info><def>crop(box=None)</def><name>crop</name><summary>Returns a rectangular region from this image.</summary><description><p>Returns a rectangular region from this image. The box is a
4-tuple defining the left, upper, right, and lower pixel
coordinate.
</p><p>
This is a lazy operation.  Changes to the source image may or
may not be reflected in the cropped image.  To break the
connection, call the <a class="link" href="#PIL.Image.Image.load-method"><b>load</b></a> method on the cropped
copy.

</p></description><param name="The">crop rectangle, as a (left, upper, right, lower)-tuple.</param><return>An Image object.</return><docstring>Crop region from image</docstring></info></method><method lineno="783" name="PIL.Image.Image.draft"><info><def>draft(mode, size)</def><name>draft</name><summary>Configures the image file loader so it returns a version of the
image that as closely as possible matches the given mode and
size.</summary><description><p>Configures the image file loader so it returns a version of the
image that as closely as possible matches the given mode and
size.  For example, you can use this method to convert a colour
JPEG to greyscale while loading it, or to extract a 128x192
version from a PCD file.
</p><p>
Note that this method modifies the Image object in place.  If
the image has already been loaded, this method has no effect.

</p></description><param name="mode">The requested mode.</param><param name="size">The requested size.</param><docstring>Configure image decoder</docstring></info></method><method lineno="788" name="PIL.Image.Image._expand"><info><def>_expand(xmargin, ymargin=None)</def><name>_expand</name></info></method><method lineno="802" name="PIL.Image.Image.filter"><info><def>filter(filter)</def><name>filter</name><summary>Filters this image using the given filter.</summary><description><p>Filters this image using the given filter.  For a list of
available filters, see the <b>ImageFilter</b> module.

</p></description><param name="filter">Filter kernel.</param><return>An Image object.</return><see>ImageFilter</see><docstring>Apply environment filter to image</docstring></info></method><method lineno="826" name="PIL.Image.Image.getbands"><info><def>getbands()</def><name>getbands</name><summary>Returns a tuple containing the name of each band in this image.</summary><description><p>Returns a tuple containing the name of each band in this image.
For example, <b>getbands</b> on an RGB image returns ("R", "G", "B").

</p></description><return>A tuple containing band names.</return><docstring>Get band names</docstring></info></method><method lineno="839" name="PIL.Image.Image.getbbox"><info><def>getbbox()</def><name>getbbox</name><summary>Calculates the bounding box of the non-zero regions in the
image.</summary><description>Calculates the bounding box of the non-zero regions in the
image.</description><return>The bounding box is returned as a 4-tuple defining the
   left, upper, right, and lower pixel coordinate. If the image
   is completely empty, this method returns None.</return><docstring>Get bounding box of actual data (non-zero pixels) in image</docstring></info></method><method lineno="853" name="PIL.Image.Image.getcolors"><info><def>getcolors(maxcolors=256)</def><name>getcolors</name><summary>Returns a list of colors used in this image.</summary><description>Returns a list of colors used in this image.</description><param name="maxcolors">Maximum number of colors.  If this number is
   exceeded, this method returns None.  The default limit is
   256 colors.</param><return>An unsorted list of (count, pixel) values.</return><docstring>Get colors from image, up to given limit</docstring></info></method><method lineno="884" name="PIL.Image.Image.getdata"><info><def>getdata(band=None)</def><name>getdata</name><summary>Returns the contents of this image as a sequence object
containing pixel values.</summary><description><p>Returns the contents of this image as a sequence object
containing pixel values.  The sequence object is flattened, so
that values for line one follow directly after the values of
line zero, and so on.
</p><p>
Note that the sequence object returned by this method is an
internal PIL data type, which only supports certain sequence
operations.  To convert it to an ordinary sequence (e.g. for
printing), use <b>list(im.getdata())</b>.

</p></description><param name="band">What band to return.  The default is to return
   all bands.  To return a single band, pass in the index
   value (e.g. 0 to get the "R" band from an "RGB" image).</param><return>A sequence-like object.</return><docstring>Get image data as sequence object.</docstring></info></method><method lineno="900" name="PIL.Image.Image.getextrema"><info><def>getextrema()</def><name>getextrema</name><summary>Gets the the minimum and maximum pixel values for each band in
the image.</summary><description>Gets the the minimum and maximum pixel values for each band in
the image.</description><return>For a single-band image, a 2-tuple containing the
   minimum and maximum pixel value.  For a multi-band image,
   a tuple containing one 2-tuple for each band.</return><docstring>Get min/max value</docstring></info></method><method lineno="916" name="PIL.Image.Image.getim"><info><def>getim()</def><name>getim</name><summary>Returns a PyCObject that points to the internal image memory.</summary><description>Returns a PyCObject that points to the internal image memory.</description><return>A PyCObject object.</return><docstring>Get PyCObject pointer to internal image memory</docstring></info></method><method lineno="929" name="PIL.Image.Image.getpalette"><info><def>getpalette()</def><name>getpalette</name><summary>Returns the image palette as a list.</summary><description>Returns the image palette as a list.</description><return>A list of color values [r, g, b, ...], or None if the
   image has no palette.</return><docstring>Get palette contents.</docstring></info></method><method lineno="946" name="PIL.Image.Image.getpixel"><info><def>getpixel(xy)</def><name>getpixel</name><summary>Returns the pixel value at a given position.</summary><description>Returns the pixel value at a given position.</description><param name="xy">The coordinate, given as (x, y).</param><return>The pixel value.  If the image is a multi-layer image,
   this method returns a tuple.</return><docstring>Get pixel value</docstring></info></method><method lineno="958" name="PIL.Image.Image.getprojection"><info><def>getprojection()</def><name>getprojection</name><summary>Returns the horizontal and vertical projection.</summary><description>Returns the horizontal and vertical projection.</description><return>Two sequences, indicating where there are non-zero
    pixels along the X-axis and the Y-axis, respectively.</return><docstring>Get projection to x and y axes</docstring></info></method><method lineno="984" name="PIL.Image.Image.histogram"><info><name>histogram</name><summary>Returns a histogram for the image.</summary><description><p>Returns a histogram for the image. The histogram is returned as
a list of pixel counts, one for each pixel value in the source
image. If the image has more than one band, the histograms for
all bands are concatenated (for example, the histogram for an
"RGB" image contains 768 values).
</p><p>
A bilevel image (mode "1") is treated as a greyscale ("L") image
by this method.
</p><p>
If a mask is provided, the method returns a histogram for those
parts of the image where the mask image is non-zero. The mask
image must have the same size as the image, and be either a
bi-level image (mode "1") or a greyscale image ("L").

</p></description><def>histogram(mask=None)</def><param name="mask">An optional mask.</param><return>A list containing pixel counts.</return><docstring>Take histogram of image</docstring></info></method><method lineno="1010" name="PIL.Image.Image.offset"><info><def>offset(xoffset, yoffset=None)</def><name>offset</name><summary>(Deprecated) Returns a copy of the image where the data has been
offset by the given distances.</summary><description><p>(Deprecated) Returns a copy of the image where the data has been
offset by the given distances. Data wraps around the edges. If
yoffset is omitted, it is assumed to be equal to xoffset.
</p><p>
This method is deprecated. New code should use the <b>offset</b>
function in the <b>ImageChops</b> module.

</p></description><param name="xoffset">The horizontal distance.</param><param name="yoffset">The vertical distance.  If omitted, both
   distances are set to the same value.</param><return>An Image object.</return><docstring>(deprecated) Offset image in horizontal and/or vertical direction</docstring></info></method><method lineno="1059" name="PIL.Image.Image.paste"><info><def>paste(im, box=None, mask=None)</def><name>paste</name><summary>Pastes another image into this image.</summary><description><p>Pastes another image into this image. The box argument is either
a 2-tuple giving the upper left corner, a 4-tuple defining the
left, upper, right, and lower pixel coordinate, or None (same as
(0, 0)).  If a 4-tuple is given, the size of the pasted image
must match the size of the region.
</p><p>
If the modes don't match, the pasted image is converted to the
mode of this image (see the <a class="link" href="#PIL.Image.Image.convert-method"><b>convert</b></a> method for
details).
</p><p>
Instead of an image, the source can be a integer or tuple
containing pixel values.  The method then fills the region
with the given colour.  When creating RGB images, you can
also use colour strings as supported by the ImageColor module.
</p><p>
If a mask is given, this method updates only the regions
indicated by the mask.  You can use either "1", "L" or "RGBA"
images (in the latter case, the alpha band is used as mask).
Where the mask is 255, the given image is copied as is.  Where
the mask is 0, the current value is preserved.  Intermediate
values can be used for transparency effects.
</p><p>
Note that if you paste an "RGBA" image, the alpha band is
ignored.  You can work around this by using the same image as
both source image and mask.

</p></description><param name="im">Source image or pixel value (integer or tuple).</param><param name="box"><p>An optional 4-tuple giving the region to paste into.
   If a 2-tuple is used instead, it's treated as the upper left
   corner.  If omitted or None, the source is pasted into the
   upper left corner.
   </p><p>
   If an image is given as the second argument and there is no
   third, the box defaults to (0, 0), and the second argument
   is interpreted as a mask image.
</p></param><param name="mask">An optional mask image.</param><return>An Image object.</return><docstring>Paste other image into region</docstring></info></method><method lineno="1118" name="PIL.Image.Image.point"><info><def>point(lut, mode=None)</def><name>point</name><summary>Maps this image through a lookup table or function.</summary><description>Maps this image through a lookup table or function.</description><param name="lut">A lookup table, containing 256 values per band in the
   image. A function can be used instead, it should take a single
   argument. The function is called once for each possible pixel
   value, and the resulting table is applied to all bands of the
   image.</param><param name="mode">Output mode (default is same as input).  In the
   current version, this can only be used if the source image
   has mode "L" or "P", and the output has mode "1".</param><return>An Image object.</return><docstring>Map image through lookup table</docstring></info></method><method lineno="1150" name="PIL.Image.Image.putalpha"><info><def>putalpha(alpha)</def><name>putalpha</name><summary>Adds or replaces the alpha layer in this image.</summary><description>Adds or replaces the alpha layer in this image.  If the image
does not have an alpha layer, it's converted to "LA" or "RGBA".
The new layer must be either "L" or "1".</description><param name="im">The new alpha layer.  This can either be an "L" or "1"
   image having the same size as this image, or an integer or
   other color value.</param><docstring>Set alpha layer</docstring></info></method><method lineno="1208" name="PIL.Image.Image.putdata"><info><def>putdata(data, scale=1.0, offset=0.0)</def><name>putdata</name><summary>Copies pixel data to this image.</summary><description><p>Copies pixel data to this image.  This method copies data from a
sequence object into the image, starting at the upper left
corner (0, 0), and continuing until either the image or the
sequence ends.  The scale and offset values are used to adjust
the sequence values: <b>pixel = value*scale + offset</b>.

</p></description><param name="data">A sequence object.</param><param name="scale">An optional scale value.  The default is 1.0.</param><param name="offset">An optional offset value.  The default is 0.0.</param><docstring>Put data from a sequence object into an image.</docstring></info></method><method lineno="1228" name="PIL.Image.Image.putpalette"><info><name>putpalette</name><summary>Attaches a palette to this image.</summary><description>Attaches a palette to this image.  The image must be a "P" or
"L" image, and the palette sequence must contain 768 integer
values, where each group of three values represent the red,
green, and blue values for the corresponding pixel
index. Instead of an integer sequence, you can use an 8-bit
string.</description><def>putpalette(data)</def><param name="data">A palette sequence (either a list or a string).</param><docstring>Put palette data into an image.</docstring></info></method><method lineno="1260" name="PIL.Image.Image.putpixel"><info><def>putpixel(xy, value)</def><name>putpixel</name><summary>Modifies the pixel at the given position.</summary><description><p>Modifies the pixel at the given position. The colour is given as
a single numerical value for single-band images, and a tuple for
multi-band images.
</p><p>
Note that this method is relatively slow.  For more extensive
changes, use <a class="link" href="#PIL.Image.Image.paste-method"><b>paste</b></a> or the <b>ImageDraw</b> module
instead.

</p></description><param name="xy">The pixel coordinate, given as (x, y).</param><param name="value">The pixel value.</param><see>#Image.paste</see><see>#Image.putdata</see><see>ImageDraw</see><docstring>Set pixel value</docstring></info></method><method lineno="1284" name="PIL.Image.Image.resize"><info><name>resize</name><summary>Returns a resized copy of this image.</summary><description>Returns a resized copy of this image.</description><def>resize(size, filter=NEAREST)</def><param name="size">The requested size in pixels, as a 2-tuple:
   (width, height).</param><param name="filter"><p>An optional resampling filter.  This can be
   one of <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
   (linear interpolation in a 2x2 environment), <b>BICUBIC</b>
   (cubic spline interpolation in a 4x4 environment), or
   <b>ANTIALIAS</b> (a high-quality downsampling filter).
   If omitted, or if the image has mode "1" or "P", it is
   set <b>NEAREST</b>.
</p></param><return>An Image object.</return><docstring>Resize image</docstring></info></method><method lineno="1325" name="PIL.Image.Image.rotate"><info><name>rotate</name><summary>Returns a rotated copy of this image.</summary><description>Returns a rotated copy of this image.  This method returns a
copy of this image, rotated the given number of degrees counter
clockwise around its centre.</description><def>rotate(angle, filter=NEAREST)</def><param name="angle">In degrees counter clockwise.</param><param name="filter"><p>An optional resampling filter.  This can be
   one of <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
   (linear interpolation in a 2x2 environment), or <b>BICUBIC</b>
   (cubic spline interpolation in a 4x4 environment).
   If omitted, or if the image has mode "1" or "P", it is
   set <b>NEAREST</b>.
</p></param><param name="expand">Optional expansion flag.  If true, expands the output
   image to make it large enough to hold the entire rotated image.
   If false or omitted, make the output image the same size as the
   input image.</param><return>An Image object.</return><docstring>Rotate image.  Angle given as degrees counter-clockwise.</docstring></info><function lineno="1335" name="PIL.Image.Image.rotate.transform"><info><def>transform(x, y, (a, b, c, d, e, f)=matrix)</def><name>transform</name></info></function></method><method lineno="1394" name="PIL.Image.Image.save"><info><name>save</name><summary>Saves this image under the given filename.</summary><description><p>Saves this image under the given filename.  If no format is
specified, the format to use is determined from the filename
extension, if possible.
</p><p>
Keyword options can be used to provide additional instructions
to the writer. If a writer doesn't recognise an option, it is
silently ignored. The available options are described later in
this handbook.
</p><p>
You can use a file object instead of a filename. In this case,
you must always specify the format. The file object must
implement the <b>seek</b>, <b>tell</b>, and <b>write</b>
methods, and be opened in binary mode.

</p></description><def>save(file, format=None, **options)</def><param name="file">File name or file object.</param><param name="format">Optional format override.  If omitted, the
   format to use is determined from the filename extension.
   If a file object was used instead of a filename, this
   parameter should always be used.</param><param name="**options">Extra parameters to the image writer.</param><return>None</return><exception name="KeyError">If the output format could not be determined
   from the file name.  Use the format option to solve this.</exception><exception name="IOError">If the file could not be written.  The file
   may have been created, and may contain partial data.</exception><docstring>Save image to file or stream</docstring></info></method><method lineno="1459" name="PIL.Image.Image.seek"><info><def>seek(frame)</def><name>seek</name><summary>Seeks to the given frame in this sequence file.</summary><description><p>Seeks to the given frame in this sequence file. If you seek
beyond the end of the sequence, the method raises an
<b>EOFError</b> exception. When a sequence file is opened, the
library automatically seeks to frame 0.
</p><p>
Note that in the current version of the library, most sequence
formats only allows you to seek to the next frame.

</p></description><param name="frame">Frame number, starting at 0.</param><exception name="EOFError">If the call attempts to seek beyond the end
    of the sequence.</exception><see>#Image.tell</see><docstring>Seek to given frame in sequence file</docstring></info></method><method lineno="1480" name="PIL.Image.Image.show"><info><name>show</name><summary>Displays this image.</summary><description><p>Displays this image. This method is mainly intended for
debugging purposes.
</p><p>
On Unix platforms, this method saves the image to a temporary
PPM file, and calls the <b>xv</b> utility.
</p><p>
On Windows, it saves the image to a temporary BMP file, and uses
the standard BMP display utility to show it (usually Paint).

</p></description><def>show(title=None)</def><param name="title">Optional title to use for the image window,
   where possible.</param><docstring>Display image (for debug purposes only)</docstring></info></method><method lineno="1494" name="PIL.Image.Image.split"><info><def>split()</def><name>split</name><summary>Split this image into individual bands.</summary><description>Split this image into individual bands. This method returns a
tuple of individual image bands from an image. For example,
splitting an "RGB" image creates three new images each
containing a copy of one of the original bands (red, green,
blue).</description><return>A tuple containing bands.</return><docstring>Split image into bands</docstring></info></method><method lineno="1512" name="PIL.Image.Image.tell"><info><def>tell()</def><name>tell</name><summary>Returns the current frame number.</summary><description>Returns the current frame number.</description><return>Frame number, starting with 0.</return><see>#Image.seek</see><docstring>Return current frame number</docstring></info></method><method lineno="1542" name="PIL.Image.Image.thumbnail"><info><def>thumbnail(size, resample=NEAREST)</def><name>thumbnail</name><summary>Make this image into a thumbnail.</summary><description><p>Make this image into a thumbnail.  This method modifies the
image to contain a thumbnail version of itself, no larger than
the given size.  This method calculates an appropriate thumbnail
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
applicable), and finally resizes the image.
</p><p>
Note that the bilinear and bicubic filters in the current
version of PIL are not well-suited for thumbnail generation.
You should use <b>ANTIALIAS</b> unless speed is much more
important than quality.
</p><p>
Also note that this function modifies the Image object in place.
If you need to use the full resolution image as well, apply this
method to a <a class="link" href="#PIL.Image.Image.copy-method"><b>copy</b></a> of the original image.

</p></description><param name="size">Requested size.</param><param name="resample"><p>Optional resampling filter.  This can be one
   of <b>NEAREST</b>, <b>BILINEAR</b>, <b>BICUBIC</b>, or
   <b>ANTIALIAS</b> (best quality).  If omitted, it defaults
   to <b>NEAREST</b> (this will be changed to ANTIALIAS in a
   future version).
</p></param><return>None</return><docstring>Create thumbnail representation (modifies image in place)</docstring></info></method><method lineno="1599" name="PIL.Image.Image.transform"><info><name>transform</name><summary>Transforms this image.</summary><description><p>Transforms this image.  This method creates a new image with the
given size, and the same mode as the original, and copies data
to the new image using the given transform.
</p><p>
</p></description><def>transform(size, method, data, resample=NEAREST)</def><param name="size">The output size.</param><param name="method"><p>The transformation method.  This is one of
  <b>EXTENT</b> (cut out a rectangular subregion), <b>AFFINE</b>
  (affine transform), <b>PERSPECTIVE</b> (perspective
  transform), <b>QUAD</b> (map a quadrilateral to a
  rectangle), or <b>MESH</b> (map a number of source quadrilaterals
  in one operation).
</p></param><param name="data">Extra data to the transformation method.</param><param name="resample"><p>Optional resampling filter.  It can be one of
   <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
   (linear interpolation in a 2x2 environment), or
   <b>BICUBIC</b> (cubic spline interpolation in a 4x4
   environment). If omitted, or if the image has mode
   "1" or "P", it is set to <b>NEAREST</b>.
</p></param><return>An Image object.</return><docstring>Transform image</docstring></info></method><method lineno="1619" name="PIL.Image.Image.__transformer"><info><def>__transformer(box, image, method, data, 
resample=NEAREST, fill=1)</def><name>__transformer</name></info></method><method lineno="1673" name="PIL.Image.Image.transpose"><info><def>transpose(method)</def><name>transpose</name><summary>Returns a flipped or rotated copy of this image.</summary><description>Returns a flipped or rotated copy of this image.</description><param name="method"><p>One of <b>FLIP_LEFT_RIGHT</b>, <b>FLIP_TOP_BOTTOM</b>,
<b>ROTATE_90</b>, <b>ROTATE_180</b>, or <b>ROTATE_270</b>.
</p></param><docstring>Transpose image (flip or rotate in 90 degree steps)</docstring></info></method></class><class lineno="1683" name="PIL.Image._ImageCrop"><info><def>_ImageCrop(Image)</def><name>_ImageCrop</name></info><method lineno="1685" name="PIL.Image._ImageCrop.__init__"><info><def>__init__(im, box)</def><name>__init__</name></info></method><method lineno="1702" name="PIL.Image._ImageCrop.load"><info><def>load()</def><name>load</name></info></method></class><class lineno="1718" name="PIL.Image.ImagePointHandler"><info><def>ImagePointHandler</def><name>ImagePointHandler</name></info></class><class lineno="1722" name="PIL.Image.ImageTransformHandler"><info><def>ImageTransformHandler</def><name>ImageTransformHandler</name></info></class><function lineno="1732" name="PIL.Image._wedge"><info><def>_wedge()</def><name>_wedge</name><docstring>Create greyscale wedge (for debugging only)</docstring></info></function><function lineno="1750" name="PIL.Image.new"><info><def>new(mode, size, color=0)</def><name>new</name><summary>Creates a new image with the given mode and size.</summary><description>Creates a new image with the given mode and size.</description><param name="mode">The mode to use for the new image.</param><param name="size">A 2-tuple, containing (width, height) in pixels.</param><param name="color">What colour to use for the image.  Default is black.
   If given, this should be a single integer or floating point value
   for single-band modes, and a tuple for multi-band modes (one value
   per band).  When creating RGB images, you can also use colour
   strings as supported by the ImageColor module.  If the colour is
   None, the image is not initialised.</param><return>An Image object.</return><docstring>Create a new image</docstring></info></function><function lineno="1786" name="PIL.Image.fromstring"><info><def>fromstring(mode, size, data, decoder_name="raw", *args)</def><name>fromstring</name><summary>Creates an image memory from pixel data in a string.</summary><description><p>Creates an image memory from pixel data in a string.
</p><p>
In its simplest form, this function takes three arguments
(mode, size, and unpacked pixel data).
</p><p>
You can also use any pixel decoder supported by PIL.  For more
information on available decoders, see the section <a href="pil-decoder.htm"><i>Writing Your Own File Decoder</i></a>.
</p><p>
Note that this function decodes pixel data only, not entire images.
If you have an entire image in a string, wrap it in a
<b>StringIO</b> object, and use <a class="link" href="#PIL.Image.open-function"><b>open</b></a> to load it.

</p></description><param name="mode">The image mode.</param><param name="size">The image size.</param><param name="data">An 8-bit string containing raw data for the given mode.</param><param name="decoder_name">What decoder to use.</param><param name="*args">Additional parameters for the given decoder.</param><return>An Image object.</return><docstring>Load image from string</docstring></info></function><function lineno="1833" name="PIL.Image.frombuffer"><info><def>frombuffer(mode, size, data, decoder_name="raw", *args)</def><name>frombuffer</name><summary>(New in 1.1.4) Creates an image memory from pixel data in a string
or byte buffer.</summary><description><p>(New in 1.1.4) Creates an image memory from pixel data in a string
or byte buffer.
</p><p>
This function is similar to <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a>, but uses data in
the byte buffer, where possible.  This means that changes to the
original buffer object are reflected in this image).  Not all modes
can share memory; supported modes include "L", "RGBX", "RGBA", and
"CMYK".
</p><p>
Note that this function decodes pixel data only, not entire images.
If you have an entire image file in a string, wrap it in a
<b>StringIO</b> object, and use <a class="link" href="#PIL.Image.open-function"><b>open</b></a> to load it.
</p><p>
In the current version, the default parameters used for the "raw"
decoder differs from that used for <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a>.  This is a
bug, and will probably be fixed in a future release.  The current
release issues a warning if you do this; to disable the warning,
you should provide the full set of parameters.  See below for
details.

</p></description><param name="mode">The image mode.</param><param name="size">The image size.</param><param name="data">An 8-bit string or other buffer object containing raw
    data for the given mode.</param><param name="decoder_name">What decoder to use.</param><param name="*args"><p>Additional parameters for the given decoder.  For the
    default encoder ("raw"), it's recommended that you provide the
    full set of parameters:
    <b>frombuffer(mode, size, data, "raw", mode, 0, 1)</b>.
</p></param><return>An Image object.</return><since>1.1.4</since><docstring>Load image from string or buffer</docstring></info></function><function lineno="1872" name="PIL.Image.fromarray"><info><def>fromarray(obj, mode=None)</def><name>fromarray</name><summary>(New in 1.1.6) Creates an image memory from an object exporting
the array interface (using the buffer protocol).</summary><description><p>(New in 1.1.6) Creates an image memory from an object exporting
the array interface (using the buffer protocol).

If obj is not contiguous, then the tostring method is called
and <a class="link" href="#PIL.Image.frombuffer-function"><b>frombuffer</b></a> is used.

</p></description><param name="obj">Object with array interface</param><param name="mode">Mode to use (will be determined from type if None)</param><return>An image memory.</return></info></function><function lineno="1943" name="PIL.Image.open"><info><name>open</name><summary>Opens and identifies the given image file.</summary><description><p>Opens and identifies the given image file.
</p><p>
This is a lazy operation; this function identifies the file, but the
actual image data is not read from the file until you try to process
the data (or call the <a class="link" href="#PIL.Image.Image.load-method"><b>load</b></a> method).

</p></description><def>open(file, mode="r")</def><param name="file"><p>A filename (string) or a file object.  The file object
   must implement <b>read</b>, <b>seek</b>, and <b>tell</b> methods,
   and be opened in binary mode.
</p></param><param name="mode">The mode.  If given, this argument must be "r".</param><return>An Image object.</return><exception name="IOError">If the file cannot be found, or the image cannot be
   opened and identified.</exception><see>#new</see><docstring>Open an image file, without loading the raster data</docstring></info></function><function lineno="2003" name="PIL.Image.blend"><info><def>blend(im1, im2, alpha)</def><name>blend</name><summary>Creates a new image by interpolating between two input images, using
a constant alpha.</summary><description><p>Creates a new image by interpolating between two input images, using
a constant alpha.

<pre>
   out = image1 * (1.0 - alpha) + image2 * alpha
</pre>

</p></description><param name="im1">The first image.</param><param name="im2">The second image.  Must have the same mode and size as
   the first image.</param><param name="alpha">The interpolation alpha factor.  If alpha is 0.0, a
   copy of the first image is returned. If alpha is 1.0, a copy of
   the second image is returned. There are no restrictions on the
   alpha value. If necessary, the result is clipped to fit into
   the allowed output range.</param><return>An Image object.</return><docstring>Interpolate between images.</docstring></info></function><function lineno="2021" name="PIL.Image.composite"><info><def>composite(image1, image2, mask)</def><name>composite</name><summary>Creates a new image by interpolating between two input images,
using the mask as alpha.</summary><description>Creates a new image by interpolating between two input images,
using the mask as alpha.</description><param name="image1">The first image.</param><param name="image2">The second image.  Must have the same mode and
   size as the first image.</param><param name="mask">A mask image.  This image can can have mode
   "1", "L", or "RGBA", and must have the same size as the
   other two images.</param><docstring>Create composite image by blending images using a transparency mask</docstring></info></function><function lineno="2040" name="PIL.Image.eval"><info><name>eval</name><summary>Applies the function (which should take one argument) to each pixel
in the given image.</summary><description>Applies the function (which should take one argument) to each pixel
in the given image. If the image has more than one band, the same
function is applied to each band. Note that the function is
evaluated once for each possible pixel value, so you cannot use
random components or other generators.</description><def>eval(image, function)</def><param name="image">The input image.</param><param name="function">A function object, taking one integer argument.</param><return>An Image object.</return><docstring>Evaluate image expression</docstring></info></function><function lineno="2054" name="PIL.Image.merge"><info><def>merge(mode, bands)</def><name>merge</name><summary>Creates a new image from a number of single-band images.</summary><description>Creates a new image from a number of single-band images.</description><param name="mode">The mode to use for the output image.</param><param name="bands">A sequence containing one single-band image for
    each band in the output image.  All bands must have the
    same size.</param><return>An Image object.</return><docstring>Merge a set of single band images into a new multiband image.</docstring></info></function><function lineno="2082" name="PIL.Image.register_open"><info><def>register_open(id, factory, accept=None)</def><name>register_open</name><summary>Register an image file plugin.</summary><description>Register an image file plugin.  This function should not be used
in application code.</description><param name="id">An image format identifier.</param><param name="factory">An image file factory method.</param><param name="accept">An optional function that can be used to quickly
   reject images having another format.</param></info></function><function lineno="2094" name="PIL.Image.register_mime"><info><def>register_mime(id, mimetype)</def><name>register_mime</name><summary>Registers an image MIME type.</summary><description>Registers an image MIME type.  This function should not be used
in application code.</description><param name="id">An image format identifier.</param><param name="mimetype">The image MIME type for this format.</param></info></function><function lineno="2104" name="PIL.Image.register_save"><info><def>register_save(id, driver)</def><name>register_save</name><summary>Registers an image save function.</summary><description>Registers an image save function.  This function should not be
used in application code.</description><param name="id">An image format identifier.</param><param name="driver">A function to save images in this format.</param></info></function><function lineno="2114" name="PIL.Image.register_extension"><info><def>register_extension(id, extension)</def><name>register_extension</name><summary>Registers an image extension.</summary><description>Registers an image extension.  This function should not be
used in application code.</description><param name="id">An image format identifier.</param><param name="extension">An extension used for this format.</param></info></function><function lineno="2121" name="PIL.Image._show"><info><def>_show(image, **options)</def><name>_show</name></info></function><function lineno="2125" name="PIL.Image._showxv"><info><def>_showxv(image, title=None, **options)</def><name>_showxv</name></info></function></module>