Skip to content

Commit

Permalink
Fix ImageChops documentation.
Browse files Browse the repository at this point in the history
Many methods were incorrectly documented as requriring mode "1". The remaining
ones require *both* images to be mode "1".

Documentation only, [ci skip]
  • Loading branch information
d0sboots committed May 1, 2020
1 parent 51f31f3 commit cc39dba
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/PIL/ImageChops.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def invert(image):
def lighter(image1, image2):
"""
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
Expand All @@ -71,7 +71,7 @@ def lighter(image1, image2):
def darker(image1, image2):
"""
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
Expand All @@ -88,7 +88,7 @@ def darker(image1, image2):
def difference(image1, image2):
"""
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
Expand All @@ -107,8 +107,7 @@ def multiply(image1, image2):
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. At least
one of the images must have mode "1".
you multiply with a solid white image, the image is unaffected.
.. code-block:: python
Expand All @@ -124,8 +123,7 @@ def multiply(image1, image2):

def screen(image1, image2):
"""
Superimposes two inverted images on top of each other. At least one of the
images must have mode "1".
Superimposes two inverted images on top of each other.
.. code-block:: python
Expand Down Expand Up @@ -179,7 +177,6 @@ def add(image1, image2, scale=1.0, offset=0):
"""
Adds 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 images must have mode "1".
.. code-block:: python
Expand All @@ -196,8 +193,7 @@ def add(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.
If omitted, scale defaults to 1.0, and offset to 0.0. At least one of the
images must have mode "1".
If omitted, scale defaults to 1.0, and offset to 0.0.
.. code-block:: python
Expand All @@ -212,8 +208,7 @@ def subtract(image1, image2, scale=1.0, offset=0):


def add_modulo(image1, image2):
"""Add two images, without clipping the result. At least one of the images
must have mode "1".
"""Add two images, without clipping the result.
.. code-block:: python
Expand All @@ -228,8 +223,7 @@ def add_modulo(image1, image2):


def subtract_modulo(image1, image2):
"""Subtract two images, without clipping the result. At least one of the
images must have mode "1".
"""Subtract two images, without clipping the result.
.. code-block:: python
Expand All @@ -244,8 +238,10 @@ def subtract_modulo(image1, image2):


def logical_and(image1, image2):
"""Logical AND between two images. At least one of the images must have
mode "1".
"""Logical AND between two images.
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
Expand All @@ -260,8 +256,9 @@ def logical_and(image1, image2):


def logical_or(image1, image2):
"""Logical OR between two images. At least one of the images must have
mode "1".
"""Logical OR between two images.
Both of the images must have mode "1".
.. code-block:: python
Expand All @@ -276,8 +273,9 @@ def logical_or(image1, image2):


def logical_xor(image1, image2):
"""Logical XOR between two images. At least one of the images must have
mode "1".
"""Logical XOR between two images.
Both of the images must have mode "1".
.. code-block:: python
Expand Down

0 comments on commit cc39dba

Please sign in to comment.