Fix ImageChops documentation.

Many methods were incorrectly documented as requriring mode "1". The remaining
ones require *both* images to be mode "1".

Documentation only, [ci skip]
This commit is contained in:
David Walker 2020-04-30 23:25:45 -07:00
parent 51f31f3f5b
commit cc39dbab0e

View File

@ -54,7 +54,7 @@ def invert(image):
def lighter(image1, image2): def lighter(image1, image2):
""" """
Compares the two images, pixel by pixel, and returns a new image containing Compares the two images, pixel by pixel, and returns a new image containing
the lighter values. At least one of the images must have mode "1". the lighter values.
.. code-block:: python .. code-block:: python
@ -71,7 +71,7 @@ def lighter(image1, image2):
def darker(image1, image2): def darker(image1, image2):
""" """
Compares the two images, pixel by pixel, and returns a new image containing Compares the two images, pixel by pixel, and returns a new image containing
the darker values. At least one of the images must have mode "1". the darker values.
.. code-block:: python .. code-block:: python
@ -88,7 +88,7 @@ def darker(image1, image2):
def difference(image1, image2): def difference(image1, image2):
""" """
Returns the absolute value of the pixel-by-pixel difference between the two Returns the absolute value of the pixel-by-pixel difference between the two
images. At least one of the images must have mode "1". images.
.. code-block:: python .. code-block:: python
@ -107,8 +107,7 @@ def multiply(image1, image2):
Superimposes two images on top of each other. Superimposes two images on top of each other.
If you multiply an image with a solid black image, the result is black. If 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. At least you multiply with a solid white image, the image is unaffected.
one of the images must have mode "1".
.. code-block:: python .. code-block:: python
@ -124,8 +123,7 @@ def multiply(image1, image2):
def screen(image1, image2): def screen(image1, image2):
""" """
Superimposes two inverted images on top of each other. At least one of the Superimposes two inverted images on top of each other.
images must have mode "1".
.. code-block:: python .. code-block:: python
@ -179,7 +177,6 @@ def add(image1, image2, scale=1.0, offset=0):
""" """
Adds two images, dividing the result by scale and adding the Adds two images, dividing the result by scale and adding the
offset. If omitted, scale defaults to 1.0, and offset to 0.0. offset. If omitted, scale defaults to 1.0, and offset to 0.0.
At least one of the images must have mode "1".
.. code-block:: python .. code-block:: python
@ -196,8 +193,7 @@ def add(image1, image2, scale=1.0, offset=0):
def subtract(image1, image2, scale=1.0, offset=0): def subtract(image1, image2, scale=1.0, offset=0):
""" """
Subtracts two images, dividing the result by scale and adding the offset. Subtracts two images, dividing the result by scale and adding the offset.
If omitted, scale defaults to 1.0, and offset to 0.0. At least one of the If omitted, scale defaults to 1.0, and offset to 0.0.
images must have mode "1".
.. code-block:: python .. code-block:: python
@ -212,8 +208,7 @@ def subtract(image1, image2, scale=1.0, offset=0):
def add_modulo(image1, image2): def add_modulo(image1, image2):
"""Add two images, without clipping the result. At least one of the images """Add two images, without clipping the result.
must have mode "1".
.. code-block:: python .. code-block:: python
@ -228,8 +223,7 @@ def add_modulo(image1, image2):
def subtract_modulo(image1, image2): def subtract_modulo(image1, image2):
"""Subtract two images, without clipping the result. At least one of the """Subtract two images, without clipping the result.
images must have mode "1".
.. code-block:: python .. code-block:: python
@ -244,8 +238,10 @@ def subtract_modulo(image1, image2):
def logical_and(image1, image2): def logical_and(image1, image2):
"""Logical AND between two images. At least one of the images must have """Logical AND between two images.
mode "1".
Both of the images must have mode "1". For an AND in RGB mode, use a
multiply() by a black-and-white mask.
.. code-block:: python .. code-block:: python
@ -260,8 +256,9 @@ def logical_and(image1, image2):
def logical_or(image1, image2): def logical_or(image1, image2):
"""Logical OR between two images. At least one of the images must have """Logical OR between two images.
mode "1".
Both of the images must have mode "1".
.. code-block:: python .. code-block:: python
@ -276,8 +273,9 @@ def logical_or(image1, image2):
def logical_xor(image1, image2): def logical_xor(image1, image2):
"""Logical XOR between two images. At least one of the images must have """Logical XOR between two images.
mode "1".
Both of the images must have mode "1".
.. code-block:: python .. code-block:: python