mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
283 lines
7.7 KiB
HTML
283 lines
7.7 KiB
HTML
|
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
|
||
|
<title>The PIL.ImageChops Module</title>
|
||
|
<link rel='stylesheet' href='effbot.css' type='text/css' />
|
||
|
</head>
|
||
|
<body>
|
||
|
<h1>The PIL.ImageChops Module</h1>
|
||
|
<p>The <b>ImageChops</b> module contains a number of arithmetical image
|
||
|
operations, called <i>channel operations</i> ("chops"). These can be
|
||
|
used for various purposes, including special effects, image
|
||
|
compositions, algorithmic painting, and more.
|
||
|
</p><p>
|
||
|
At this time, channel operations are only implemented for 8-bit
|
||
|
images (e.g. "L" and "RGB").
|
||
|
</p><p>
|
||
|
Most channel operations take one or two image arguments and returns
|
||
|
a new image. Unless otherwise noted, the result of a channel
|
||
|
operation is always clipped to the range 0 to MAX (which is 255 for
|
||
|
all modes supported by the operations in this module).
|
||
|
</p><h2>Module Contents</h2>
|
||
|
<dl>
|
||
|
<dt><a id='PIL.ImageChops.add-function' name='PIL.ImageChops.add-function'><b>add(image1, image2, scale=1.0, offset=0)</b></a> [<a href='#PIL.ImageChops.add-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Add images
|
||
|
((image1 + image2) / scale + offset).
|
||
|
</p><p>
|
||
|
Adds two images, dividing the result by scale and adding the
|
||
|
offset. If omitted, scale defaults to 1.0, and offset to 0.0.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.add_modulo-function' name='PIL.ImageChops.add_modulo-function'><b>add_modulo(image1, image2)</b></a> [<a href='#PIL.ImageChops.add_modulo-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Add images without clipping
|
||
|
((image1 + image2) % MAX).
|
||
|
</p><p>
|
||
|
Adds two images, without clipping the result.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.blend-function' name='PIL.ImageChops.blend-function'><b>blend(image1, image2, alpha)</b></a> [<a href='#PIL.ImageChops.blend-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Blend images using constant transparency weight.
|
||
|
</p><p>
|
||
|
Same as the <b>blend</b> function in the <b>Image</b> module.
|
||
|
</p></dd>
|
||
|
<dt><a id='PIL.ImageChops.composite-function' name='PIL.ImageChops.composite-function'><b>composite(image1, image2, mask)</b></a> [<a href='#PIL.ImageChops.composite-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Create composite using transparency mask.
|
||
|
</p><p>
|
||
|
Same as the <b>composite</b> function in the <b>Image</b> module.
|
||
|
</p></dd>
|
||
|
<dt><a id='PIL.ImageChops.constant-function' name='PIL.ImageChops.constant-function'><b>constant(image, value)</b></a> [<a href='#PIL.ImageChops.constant-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<dl>
|
||
|
<dt><i>image</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>value</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.darker-function' name='PIL.ImageChops.darker-function'><b>darker(image1, image2)</b></a> [<a href='#PIL.ImageChops.darker-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Compare images, and return darker pixel value
|
||
|
(min(image1, image2)).
|
||
|
</p><p>
|
||
|
Compares the two images, pixel by pixel, and returns a new image
|
||
|
containing the darker values.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.difference-function' name='PIL.ImageChops.difference-function'><b>difference(image1, image2)</b></a> [<a href='#PIL.ImageChops.difference-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Calculate absolute difference
|
||
|
(abs(image1 - image2)).
|
||
|
</p><p>
|
||
|
Returns the absolute value of the difference between the two images.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.duplicate-function' name='PIL.ImageChops.duplicate-function'><b>duplicate(image)</b></a> [<a href='#PIL.ImageChops.duplicate-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<dl>
|
||
|
<dt><i>image</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.invert-function' name='PIL.ImageChops.invert-function'><b>invert(image)</b></a> [<a href='#PIL.ImageChops.invert-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<dl>
|
||
|
<dt><i>image</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.lighter-function' name='PIL.ImageChops.lighter-function'><b>lighter(image1, image2)</b></a> [<a href='#PIL.ImageChops.lighter-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Compare images, and return lighter pixel value
|
||
|
(max(image1, image2)).
|
||
|
</p><p>
|
||
|
Compares the two images, pixel by pixel, and returns a new image
|
||
|
containing the lighter values.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.logical_and-function' name='PIL.ImageChops.logical_and-function'><b>logical_and(image1, image2)</b></a> [<a href='#PIL.ImageChops.logical_and-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.logical_or-function' name='PIL.ImageChops.logical_or-function'><b>logical_or(image1, image2)</b></a> [<a href='#PIL.ImageChops.logical_or-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.logical_xor-function' name='PIL.ImageChops.logical_xor-function'><b>logical_xor(image1, image2)</b></a> [<a href='#PIL.ImageChops.logical_xor-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.multiply-function' name='PIL.ImageChops.multiply-function'><b>multiply(image1, image2)</b></a> [<a href='#PIL.ImageChops.multiply-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Superimpose positive images
|
||
|
(image1 * image2 / MAX).
|
||
|
</p><p>
|
||
|
Superimposes two images on top of each other. If you multiply an
|
||
|
image with a solid black image, the result is black. If you multiply
|
||
|
with a solid white image, the image is unaffected.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.offset-function' name='PIL.ImageChops.offset-function'><b>offset(image, xoffset, yoffset=None)</b></a> [<a href='#PIL.ImageChops.offset-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Offset image data.
|
||
|
</p><p>
|
||
|
Returns a copy of the image where 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><dl>
|
||
|
<dt><i>image</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>xoffset</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>yoffset</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.screen-function' name='PIL.ImageChops.screen-function'><b>screen(image1, image2)</b></a> [<a href='#PIL.ImageChops.screen-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Superimpose negative images
|
||
|
(MAX - ((MAX - image1) * (MAX - image2) / MAX)).
|
||
|
</p><p>
|
||
|
Superimposes two inverted images on top of each other.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.subtract-function' name='PIL.ImageChops.subtract-function'><b>subtract(image1, image2, scale=1.0, offset=0)</b></a> [<a href='#PIL.ImageChops.subtract-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Subtract images
|
||
|
((image1 - image2) / scale + offset).
|
||
|
</p><p>
|
||
|
Subtracts two images, dividing the result by scale and adding the
|
||
|
offset. If omitted, scale defaults to 1.0, and offset to 0.0.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
<dt><a id='PIL.ImageChops.subtract_modulo-function' name='PIL.ImageChops.subtract_modulo-function'><b>subtract_modulo(image1, image2)</b></a> [<a href='#PIL.ImageChops.subtract_modulo-function'>#</a>]</dt>
|
||
|
<dd>
|
||
|
<p>Subtract images without clipping
|
||
|
((image1 - image2) % MAX).
|
||
|
</p><p>
|
||
|
Subtracts two images, without clipping the result.
|
||
|
|
||
|
</p><dl>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt><i>image1</i></dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
<dt>Returns:</dt>
|
||
|
<dd>
|
||
|
</dd>
|
||
|
</dl><br />
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</body></html>
|