发布于 2015-09-11 16:10:57 | 270 次阅读 | 评论: 0 | 来源: 网络整理
The ImageChops module contains a number of arithmetical image operations, called channel operations (“chops”). These can be used for various purposes, including special effects, image compositions, algorithmic painting, and more.
For more pre-made operations, see ImageOps.
At this time, most channel operations are only implemented for 8-bit images (e.g. “L” and “RGB”).
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).
Adds two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0.
out = ((image1 + image2) / scale + offset)
返回类型: | Image |
---|
Add two images, without clipping the result.
out = ((image1 + image2) % MAX)
返回类型: | Image |
---|
Blend images using constant transparency weight. Alias for PIL.Image.Image.blend().
返回类型: | Image |
---|
Create composite using transparency mask. Alias for PIL.Image.Image.composite().
返回类型: | Image |
---|
Compares the two images, pixel by pixel, and returns a new image containing the darker values.
out = min(image1, image2)
返回类型: | Image |
---|
Returns the absolute value of the pixel-by-pixel difference between the two images.
out = abs(image1 - image2)
返回类型: | Image |
---|
Copy a channel. Alias for PIL.Image.Image.copy().
返回类型: | Image |
---|
Compares the two images, pixel by pixel, and returns a new image containing the lighter values.
out = max(image1, image2)
返回类型: | Image |
---|
Logical AND between two images.
out = ((image1 and image2) % MAX)
返回类型: | Image |
---|
Logical OR between two images.
out = ((image1 or image2) % MAX)
返回类型: | Image |
---|
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.
out = image1 * image2 / MAX
返回类型: | Image |
---|
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.
参数: |
|
---|---|
返回类型: |
Superimposes two inverted images on top of each other.
out = MAX - ((MAX - image1) * (MAX - image2) / MAX)
返回类型: | Image |
---|