Skip to content

Commit e84b368

Browse files
authored
Merge pull request #4599 from d0sboots/imagechops
Fix ImageChops documentation
2 parents a28b2ea + f0871b7 commit e84b368

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/PIL/ImageChops.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def invert(image):
5454
def lighter(image1, image2):
5555
"""
5656
Compares the two images, pixel by pixel, and returns a new image containing
57-
the lighter values. At least one of the images must have mode "1".
57+
the lighter values.
5858
5959
.. code-block:: python
6060
@@ -71,7 +71,7 @@ def lighter(image1, image2):
7171
def darker(image1, image2):
7272
"""
7373
Compares the two images, pixel by pixel, and returns a new image containing
74-
the darker values. At least one of the images must have mode "1".
74+
the darker values.
7575
7676
.. code-block:: python
7777
@@ -88,7 +88,7 @@ def darker(image1, image2):
8888
def difference(image1, image2):
8989
"""
9090
Returns the absolute value of the pixel-by-pixel difference between the two
91-
images. At least one of the images must have mode "1".
91+
images.
9292
9393
.. code-block:: python
9494
@@ -107,8 +107,7 @@ def multiply(image1, image2):
107107
Superimposes two images on top of each other.
108108
109109
If you multiply an image with a solid black image, the result is black. If
110-
you multiply with a solid white image, the image is unaffected. At least
111-
one of the images must have mode "1".
110+
you multiply with a solid white image, the image is unaffected.
112111
113112
.. code-block:: python
114113
@@ -124,8 +123,7 @@ def multiply(image1, image2):
124123

125124
def screen(image1, image2):
126125
"""
127-
Superimposes two inverted images on top of each other. At least one of the
128-
images must have mode "1".
126+
Superimposes two inverted images on top of each other.
129127
130128
.. code-block:: python
131129
@@ -179,7 +177,6 @@ def add(image1, image2, scale=1.0, offset=0):
179177
"""
180178
Adds two images, dividing the result by scale and adding the
181179
offset. If omitted, scale defaults to 1.0, and offset to 0.0.
182-
At least one of the images must have mode "1".
183180
184181
.. code-block:: python
185182
@@ -196,8 +193,7 @@ def add(image1, image2, scale=1.0, offset=0):
196193
def subtract(image1, image2, scale=1.0, offset=0):
197194
"""
198195
Subtracts two images, dividing the result by scale and adding the offset.
199-
If omitted, scale defaults to 1.0, and offset to 0.0. At least one of the
200-
images must have mode "1".
196+
If omitted, scale defaults to 1.0, and offset to 0.0.
201197
202198
.. code-block:: python
203199
@@ -212,8 +208,7 @@ def subtract(image1, image2, scale=1.0, offset=0):
212208

213209

214210
def add_modulo(image1, image2):
215-
"""Add two images, without clipping the result. At least one of the images
216-
must have mode "1".
211+
"""Add two images, without clipping the result.
217212
218213
.. code-block:: python
219214
@@ -228,8 +223,7 @@ def add_modulo(image1, image2):
228223

229224

230225
def subtract_modulo(image1, image2):
231-
"""Subtract two images, without clipping the result. At least one of the
232-
images must have mode "1".
226+
"""Subtract two images, without clipping the result.
233227
234228
.. code-block:: python
235229
@@ -244,8 +238,12 @@ def subtract_modulo(image1, image2):
244238

245239

246240
def logical_and(image1, image2):
247-
"""Logical AND between two images. At least one of the images must have
248-
mode "1".
241+
"""Logical AND between two images.
242+
243+
Both of the images must have mode "1". If you would like to perform a
244+
logical AND on an image with a mode other than "1", try
245+
:py:meth:`~PIL.ImageChops.multiply` instead, using a black-and-white mask
246+
as the second image.
249247
250248
.. code-block:: python
251249
@@ -260,8 +258,9 @@ def logical_and(image1, image2):
260258

261259

262260
def logical_or(image1, image2):
263-
"""Logical OR between two images. At least one of the images must have
264-
mode "1".
261+
"""Logical OR between two images.
262+
263+
Both of the images must have mode "1".
265264
266265
.. code-block:: python
267266
@@ -276,8 +275,9 @@ def logical_or(image1, image2):
276275

277276

278277
def logical_xor(image1, image2):
279-
"""Logical XOR between two images. At least one of the images must have
280-
mode "1".
278+
"""Logical XOR between two images.
279+
280+
Both of the images must have mode "1".
281281
282282
.. code-block:: python
283283

0 commit comments

Comments
 (0)