Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions docs/releasenotes/13.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,6 @@ Two new filters are available for :py:meth:`~PIL.Image.Image.resize` and
Other changes
=============

ImageOps.crop border type annotation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``border`` type annotation for :py:func:`~PIL.ImageOps.crop` now includes
tuples, matching its existing support for two or four border widths. The tuple
ordering is also documented for :py:func:`~PIL.ImageOps.crop` and
:py:func:`~PIL.ImageOps.expand`.

Python 3.15
^^^^^^^^^^^

Expand Down
12 changes: 7 additions & 5 deletions src/PIL/ImageOps.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,10 @@ def crop(image: Image.Image, border: int | tuple[int, ...] = 0) -> Image.Image:

:param image: The image to crop.
:param border: The number of pixels to remove. An integer removes the same
number of pixels from all four sides. A 2-tuple specifies the horizontal
and vertical borders. A 4-tuple specifies the left, top, right and bottom
borders.
number of pixels from all four sides. A 2-tuple specifies
the number of pixels to remove horizontally and vertically.
A 4-tuple specifies the number of pixels to remove from the
left, top, right and bottom of the image.
:return: An image.
"""
left, top, right, bottom = _border(border)
Expand Down Expand Up @@ -519,8 +520,9 @@ def expand(

:param image: The image to expand.
:param border: Border width, in pixels. An integer adds the same width to
all four sides. A 2-tuple specifies the horizontal and vertical borders.
A 4-tuple specifies the left, top, right and bottom borders.
all four sides. A 2-tuple specifies the horizontal and
vertical border widths. A 4-tuple specifies the widths of
the left, top, right and bottom borders.
:param fill: Pixel fill value (a color value). Default is 0 (black).
:return: An image.
"""
Expand Down