Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved ImageChops documentation #3522

Merged
merged 4 commits into from
Jan 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/reference/ImageChops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ operations in this module).
.. autofunction:: PIL.ImageChops.lighter
.. autofunction:: PIL.ImageChops.logical_and
.. autofunction:: PIL.ImageChops.logical_or
.. autofunction:: PIL.ImageChops.logical_xor
.. autofunction:: PIL.ImageChops.multiply
.. py:method:: PIL.ImageChops.offset(image, xoffset, yoffset=None)

Expand Down
35 changes: 22 additions & 13 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.
the lighter values. At least one of the images must have mode "1".

.. code-block:: python

Expand All @@ -70,8 +70,8 @@ def lighter(image1, image2):

def darker(image1, image2):
"""
Compares the two images, pixel by pixel, and returns a new image
containing the darker values.
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".

.. 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.
images. At least one of the images must have mode "1".

.. code-block:: python

Expand All @@ -107,7 +107,8 @@ 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.
you multiply with a solid white image, the image is unaffected. At least
one of the images must have mode "1".

.. code-block:: python

Expand All @@ -123,7 +124,8 @@ def multiply(image1, image2):

def screen(image1, image2):
"""
Superimposes two inverted images on top of each other.
Superimposes two inverted images on top of each other. At least one of the
images must have mode "1".

.. code-block:: python

Expand All @@ -141,6 +143,7 @@ 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 @@ -156,8 +159,9 @@ 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.
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".

.. code-block:: python

Expand All @@ -172,7 +176,8 @@ def subtract(image1, image2, scale=1.0, offset=0):


def add_modulo(image1, image2):
"""Add two images, without clipping the result.
"""Add two images, without clipping the result. At least one of the images
must have mode "1".

.. code-block:: python

Expand All @@ -187,7 +192,8 @@ def add_modulo(image1, image2):


def subtract_modulo(image1, image2):
"""Subtract two images, without clipping the result.
"""Subtract two images, without clipping the result. At least one of the
images must have mode "1".

.. code-block:: python

Expand All @@ -202,7 +208,8 @@ def subtract_modulo(image1, image2):


def logical_and(image1, image2):
"""Logical AND between two images.
"""Logical AND between two images. At least one of the images must have
mode "1".

.. code-block:: python

Expand All @@ -217,7 +224,8 @@ def logical_and(image1, image2):


def logical_or(image1, image2):
"""Logical OR between two images.
"""Logical OR between two images. At least one of the images must have
mode "1".

.. code-block:: python

Expand All @@ -232,7 +240,8 @@ def logical_or(image1, image2):


def logical_xor(image1, image2):
"""Logical XOR between two images.
"""Logical XOR between two images. At least one of the images must have
mode "1".

.. code-block:: python

Expand Down