~ubuntu-branches/ubuntu/wily/python-imaging/wily

« back to all changes in this revision

Viewing changes to docs/pythondoc-PIL.ImageChops.rst

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=========================
 
2
The PIL.ImageChops Module
 
3
=========================
 
4
 
 
5
The PIL.ImageChops Module
 
6
=========================
 
7
 
 
8
The **ImageChops** module contains a number of arithmetical image
 
9
operations, called *channel operations* ("chops"). These can be used for
 
10
various purposes, including special effects, image compositions,
 
11
algorithmic painting, and more.
 
12
 
 
13
At this time, channel operations are only implemented for 8-bit images
 
14
(e.g. "L" and "RGB").
 
15
 
 
16
Most channel operations take one or two image arguments and returns a
 
17
new image. Unless otherwise noted, the result of a channel operation is
 
18
always clipped to the range 0 to MAX (which is 255 for all modes
 
19
supported by the operations in this module).
 
20
 
 
21
Module Contents
 
22
---------------
 
23
 
 
24
**add(image1, image2, scale=1.0, offset=0)**
 
25
[`# <#PIL.ImageChops.add-function>`_]
 
26
    Add images ((image1 + image2) / scale + offset).
 
27
 
 
28
    Adds two images, dividing the result by scale and adding the offset.
 
29
    If omitted, scale defaults to 1.0, and offset to 0.0.
 
30
 
 
31
    *image1*
 
32
    *image1*
 
33
    Returns:
 
34
 
 
35
**add\_modulo(image1, image2)**
 
36
[`# <#PIL.ImageChops.add_modulo-function>`_]
 
37
    Add images without clipping ((image1 + image2) % MAX).
 
38
 
 
39
    Adds two images, without clipping the result.
 
40
 
 
41
    *image1*
 
42
    *image1*
 
43
    Returns:
 
44
 
 
45
**blend(image1, image2, alpha)** [`# <#PIL.ImageChops.blend-function>`_]
 
46
    Blend images using constant transparency weight.
 
47
 
 
48
    Same as the **blend** function in the **Image** module.
 
49
 
 
50
**composite(image1, image2, mask)**
 
51
[`# <#PIL.ImageChops.composite-function>`_]
 
52
    Create composite using transparency mask.
 
53
 
 
54
    Same as the **composite** function in the **Image** module.
 
55
 
 
56
**constant(image, value)** [`# <#PIL.ImageChops.constant-function>`_]
 
57
 
 
58
    *image*
 
59
    *value*
 
60
    Returns:
 
61
 
 
62
**darker(image1, image2)** [`# <#PIL.ImageChops.darker-function>`_]
 
63
    Compare images, and return darker pixel value (min(image1, image2)).
 
64
 
 
65
    Compares the two images, pixel by pixel, and returns a new image
 
66
    containing the darker values.
 
67
 
 
68
    *image1*
 
69
    *image1*
 
70
    Returns:
 
71
 
 
72
**difference(image1, image2)**
 
73
[`# <#PIL.ImageChops.difference-function>`_]
 
74
    Calculate absolute difference (abs(image1 - image2)).
 
75
 
 
76
    Returns the absolute value of the difference between the two images.
 
77
 
 
78
    *image1*
 
79
    *image1*
 
80
    Returns:
 
81
 
 
82
**duplicate(image)** [`# <#PIL.ImageChops.duplicate-function>`_]
 
83
 
 
84
    *image*
 
85
    Returns:
 
86
 
 
87
**invert(image)** [`# <#PIL.ImageChops.invert-function>`_]
 
88
 
 
89
    *image*
 
90
    Returns:
 
91
 
 
92
**lighter(image1, image2)** [`# <#PIL.ImageChops.lighter-function>`_]
 
93
    Compare images, and return lighter pixel value (max(image1,
 
94
    image2)).
 
95
 
 
96
    Compares the two images, pixel by pixel, and returns a new image
 
97
    containing the lighter values.
 
98
 
 
99
    *image1*
 
100
    *image1*
 
101
    Returns:
 
102
 
 
103
**logical\_and(image1, image2)**
 
104
[`# <#PIL.ImageChops.logical_and-function>`_]
 
105
**logical\_or(image1, image2)**
 
106
[`# <#PIL.ImageChops.logical_or-function>`_]
 
107
**logical\_xor(image1, image2)**
 
108
[`# <#PIL.ImageChops.logical_xor-function>`_]
 
109
**multiply(image1, image2)** [`# <#PIL.ImageChops.multiply-function>`_]
 
110
    Superimpose positive images (image1 \* image2 / MAX).
 
111
 
 
112
    Superimposes two images on top of each other. If you multiply an
 
113
    image with a solid black image, the result is black. If you multiply
 
114
    with a solid white image, the image is unaffected.
 
115
 
 
116
    *image1*
 
117
    *image1*
 
118
    Returns:
 
119
 
 
120
**offset(image, xoffset, yoffset=None)**
 
121
[`# <#PIL.ImageChops.offset-function>`_]
 
122
    Offset image data.
 
123
 
 
124
    Returns a copy of the image where data has been offset by the given
 
125
    distances. Data wraps around the edges. If yoffset is omitted, it is
 
126
    assumed to be equal to xoffset.
 
127
 
 
128
    *image*
 
129
    *xoffset*
 
130
    *yoffset*
 
131
    Returns:
 
132
 
 
133
**screen(image1, image2)** [`# <#PIL.ImageChops.screen-function>`_]
 
134
    Superimpose negative images (MAX - ((MAX - image1) \* (MAX - image2)
 
135
    / MAX)).
 
136
 
 
137
    Superimposes two inverted images on top of each other.
 
138
 
 
139
    *image1*
 
140
    *image1*
 
141
    Returns:
 
142
 
 
143
**subtract(image1, image2, scale=1.0, offset=0)**
 
144
[`# <#PIL.ImageChops.subtract-function>`_]
 
145
    Subtract images ((image1 - image2) / scale + offset).
 
146
 
 
147
    Subtracts two images, dividing the result by scale and adding the
 
148
    offset. If omitted, scale defaults to 1.0, and offset to 0.0.
 
149
 
 
150
    *image1*
 
151
    *image1*
 
152
    Returns:
 
153
 
 
154
**subtract\_modulo(image1, image2)**
 
155
[`# <#PIL.ImageChops.subtract_modulo-function>`_]
 
156
    Subtract images without clipping ((image1 - image2) % MAX).
 
157
 
 
158
    Subtracts two images, without clipping the result.
 
159
 
 
160
    *image1*
 
161
    *image1*
 
162
    Returns:
 
163