Skip to content
Open
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
12 changes: 6 additions & 6 deletions Tests/test_file_gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,17 +716,17 @@ def test_dispose2_diff(tmp_path: Path) -> None:
)

with Image.open(out) as img:
for i, colours in enumerate(circles):
for i, colors in enumerate(circles):
img.seek(i)
rgb_img = img.convert("RGBA")

# Check left circle is correct colour
assert rgb_img.getpixel((20, 50)) == colours[0]
# Check left circle is correct color
assert rgb_img.getpixel((20, 50)) == colors[0]

# Check right circle is correct colour
assert rgb_img.getpixel((80, 50)) == colours[1]
# Check right circle is correct color
assert rgb_img.getpixel((80, 50)) == colors[1]

# Check BG is correct colour
# Check BG is correct color
assert rgb_img.getpixel((1, 1)) == (255, 255, 255, 0)


Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_tiff_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_rt_metadata(tmp_path: Path) -> None:

img = hopper()

# Behaviour change: re #1416
# Behavior change: re #1416
# Pre ifd rewrite, ImageJMetaData was being written as a string(2),
# Post ifd rewrite, it's defined as arbitrary bytes(7). It should
# roundtrip with the actual bytes, rather than stripped text
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def test_matrix_xyz(mode: str) -> None:
assert im.mode == "RGB"

# Act
# Convert an RGB image to the CIE XYZ colour space
# Convert an RGB image to the CIE XYZ color space
converted_im = im.convert(mode=mode, matrix=matrix)

# Assert
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_unknown_filter(self) -> None:
self.resize(hopper(), (10, 10), 9) # type: ignore[arg-type]

def test_cross_platform(self, tmp_path: Path) -> None:
# This test is intended for only check for consistent behaviour across
# This test is intended for only check for consistent behavior across
# platforms. So if a future Pillow change requires that the test file
# be updated, that is okay.
im = hopper().resize((64, 64))
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_imagedraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ def test_floodfill(bbox: Coords) -> None:
with Image.open(expected) as im_floodfill:
assert_image_equal(im, im_floodfill)

# Test that using the same colour does not change the image
# Test that using the same color does not change the image
ImageDraw.floodfill(im, centre_point, red)
assert_image_equal(im, im_floodfill)

Expand Down
4 changes: 2 additions & 2 deletions docs/handbook/image-file-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ BMP
^^^

Pillow reads and writes Windows and OS/2 BMP files containing ``1``, ``L``, ``P``,
or ``RGB`` data. 16-colour images are read as ``P`` images.
or ``RGB`` data. 16-color images are read as ``P`` images.
Support for reading 8-bit run-length encoding was added in Pillow 9.1.0.
Support for reading 4-bit run-length encoding was added in Pillow 9.3.0.

Expand Down Expand Up @@ -1192,7 +1192,7 @@ TIFF
^^^^

Pillow reads and writes TIFF files. It can read both striped and tiled
images, pixel and plane interleaved multi-band images. If you have
images, pixel and plane interleaved multiband images. If you have
libtiff and its headers installed, Pillow can read and write many kinds
of compressed TIFF files. If not, Pillow will only read and write
uncompressed files.
Expand Down
4 changes: 2 additions & 2 deletions docs/handbook/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ RGBA image and also using it as the mask would paste the opaque portion
of the image but not its transparent background.

The Python Imaging Library also allows you to work with the individual bands of
a multi-band image, such as an RGB image. The split method creates a set of
new images, each containing one band from the original multi-band image. The
a multiband image, such as an RGB image. The split method creates a set of
new images, each containing one band from the original multiband image. The
merge function takes a mode and a tuple of images, and combines them into a new
image. The following sample swaps the three bands of an RGB image:

Expand Down
2 changes: 1 addition & 1 deletion docs/handbook/writing-your-own-image-plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ The setup function needs to call ``PyImaging_DecoderNew`` or

**pulls_fd**/**pushes_fd**
If the decoder has ``pulls_fd`` or the encoder has ``pushes_fd`` set to 1,
``state->fd`` will be a pointer to the Python file like object. The codec may
``state->fd`` will be a pointer to the Python file-like object. The codec may
use the functions in ``codec_fd.c`` to read or write directly with the file
like object rather than have the data pushed through a buffer.

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/ImageFilter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ Pillow provides the following set of predefined image enhancement filters:

.. class:: MultibandFilter

An abstract mixin used for filtering multi-band images
An abstract mixin used for filtering multiband images
(for use with :py:meth:`~PIL.Image.Image.filter`).

Implementors must provide the following method:

.. method:: filter(self, image)

Applies a filter to a multi-band image.
Applies a filter to a multiband image.

:returns: A filtered copy of the image.
4 changes: 2 additions & 2 deletions docs/reference/ImageMath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
The :py:mod:`~PIL.ImageMath` module can be used to evaluate “image expressions”, that
can take a number of images and generate a result.

:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multiband
images, use the :py:meth:`~PIL.Image.Image.split` method or :py:func:`~PIL.Image.merge`
function.

Expand Down Expand Up @@ -55,7 +55,7 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
recommended to process expressions without considering this.
:py:meth:`lambda_eval` is a more secure alternative.

:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multiband
images, use the :py:meth:`~PIL.Image.Image.split` method or
:py:func:`~PIL.Image.merge` function.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/PixelAccess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Access using negative indexes is also possible. ::

Modifies the pixel at x,y. The color is given as a single
numerical value for single band images, and a tuple for
multi-band images. See :ref:`colors` for more information.
multiband images. See :ref:`colors` for more information.

:param xy: The pixel coordinate, given as (x, y).
:param color: The pixel value according to its mode,
Expand Down
2 changes: 1 addition & 1 deletion docs/releasenotes/3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ LibJpeg and Zlib are required by default

The external dependencies on libjpeg and zlib are now required by default.
If the headers or libraries are not found, then installation will abort
with an error. This behaviour can be disabled with the ``--disable-libjpeg``
with an error. This behavior can be disabled with the ``--disable-libjpeg``
and ``--disable-zlib`` flags.
2 changes: 1 addition & 1 deletion docs/releasenotes/7.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Image._showxv
~~~~~~~~~~~~~

``Image._showxv`` has been deprecated. Use :py:meth:`~PIL.Image.Image.show`
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add
instead. If custom behavior is required, use :py:meth:`~PIL.ImageShow.register` to add
a custom :py:class:`~PIL.ImageShow.Viewer` class.

ImageFile.raise_ioerror
Expand Down
6 changes: 3 additions & 3 deletions docs/releasenotes/8.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ create a circle, but not any other ellipse. ::
ImageOps.autocontrast: preserve_tone
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The default behaviour of :py:meth:`~PIL.ImageOps.autocontrast` is to normalize
The default behavior of :py:meth:`~PIL.ImageOps.autocontrast` is to normalize
separate histograms for each color channel, changing the tone of the image. The new
``preserve_tone`` argument keeps the tone unchanged by using one luminance histogram
for all channels.
Expand All @@ -154,7 +154,7 @@ be registered. It uses GraphicsMagick_, an ImageMagick_ fork, to display images.
The GraphicsMagick based viewer has a lower priority than its ImageMagick
counterpart. Thus, if both ImageMagick and GraphicsMagick are installed,
``im.show()`` and :py:func:`.ImageShow.show()` prefer the viewer based on
ImageMagick, i.e the behaviour stays the same for Pillow users having
ImageMagick, i.e the behavior stays the same for Pillow users having
ImageMagick installed.

ImageShow.IPythonViewer
Expand All @@ -166,7 +166,7 @@ to users of Google Colab, allowing ``im.show()`` to display images.

It is lower in priority than the other default :py:class:`PIL.ImageShow.Viewer`
instances, so it will only be used by ``im.show()`` or :py:func:`.ImageShow.show()`
if none of the other viewers are available. This means that the behaviour of
if none of the other viewers are available. This means that the behavior of
:py:class:`PIL.ImageShow` will stay the same for most Pillow users.

Saving TIFF with ICC profile
Expand Down
2 changes: 1 addition & 1 deletion docs/releasenotes/9.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Image._showxv
^^^^^^^^^^^^^

``Image._showxv`` has been removed. Use :py:meth:`~PIL.Image.Image.show`
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add
instead. If custom behavior is required, use :py:meth:`~PIL.ImageShow.register` to add
a custom :py:class:`~PIL.ImageShow.Viewer` class.

ImageFile.raise_ioerror
Expand Down
2 changes: 1 addition & 1 deletion docs/releasenotes/9.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ GifImagePlugin loading strategy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Pillow 9.0.0 introduced the conversion of subsequent GIF frames to ``RGB`` or ``RGBA``. This
behaviour can now be changed so that the first ``P`` frame is converted to ``RGB`` as
behavior can now be changed so that the first ``P`` frame is converted to ``RGB`` as
well. ::

from PIL import GifImagePlugin
Expand Down
2 changes: 1 addition & 1 deletion docs/releasenotes/9.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Initialize libtiff buffer when saving
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When saving a TIFF image to a file object using libtiff, the buffer was not
initialized. This behaviour introduced in Pillow 2.0.0, and has now been fixed.
initialized. This behavior introduced in Pillow 2.0.0, and has now been fixed.

Decode JPEG compressed BLP1 data in original mode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/FpxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from . import Image, ImageFile
from ._binary import i32le as i32

# we map from colour field tuples to (mode, rawmode) descriptors
# we map from color field tuples to (mode, rawmode) descriptors
MODES = {
# opacity
(0x00007FFE,): ("A", "L"),
Expand Down
6 changes: 3 additions & 3 deletions src/PIL/GifImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# 1995-09-01 fl Created
# 1996-12-14 fl Added interlace support
# 1996-12-30 fl Added animation support
# 1997-01-05 fl Added write support, fixed local colour map bug
# 1997-01-05 fl Added write support, fixed local color map bug
# 1997-02-23 fl Make sure to load raster data in getdata()
# 1997-07-05 fl Support external decoder (0.4)
# 1998-07-09 fl Handle all modes when saving (0.5)
Expand Down Expand Up @@ -115,7 +115,7 @@ def _open(self) -> None:
if flags & 128:
# get global palette
self.info["background"] = s[11]
# check if palette contains colour indices
# check if palette contains color indices
p = self.fp.read(3 << bits)
if self._is_palette_needed(p):
palette = ImagePalette.raw("RGB", p)
Expand Down Expand Up @@ -366,7 +366,7 @@ def _rgb(color: int) -> tuple[int, int, int]:
if self.dispose_extent and self.disposal_method >= 2:
try:
if self.disposal_method == 2:
# replace with background colour
# replace with background color

# only dispose the extent in this frame
x0, y0, x1, y1 = self.dispose_extent
Expand Down
10 changes: 5 additions & 5 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ def getextrema(self) -> tuple[float, float] | tuple[tuple[int, int], ...]:
the image.

:returns: For a single-band image, a 2-tuple containing the
minimum and maximum pixel value. For a multi-band image,
minimum and maximum pixel value. For a multiband image,
a tuple containing one 2-tuple for each band.
"""

Expand Down Expand Up @@ -2174,7 +2174,7 @@ def putpixel(
"""
Modifies the pixel at the given position. The color is given as
a single numerical value for single-band images, and a tuple for
multi-band images. In addition to this, RGB and RGBA tuples are
multiband images. In addition to this, RGB and RGBA tuples are
accepted for P and PA images. See :ref:`colors` for more information.

Note that this method is relatively slow. For more extensive changes,
Expand Down Expand Up @@ -2474,7 +2474,7 @@ def rotate(
copy of this image, rotated the given number of degrees counter
clockwise around its centre.

:param angle: In degrees counter clockwise.
:param angle: In degrees counter-clockwise.
:param resample: An optional resampling filter. This can be
one of :py:data:`Resampling.NEAREST` (use nearest neighbour),
:py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
Expand Down Expand Up @@ -2745,7 +2745,7 @@ def show(self, title: str | None = None) -> None:
Displays this image. This method is mainly intended for debugging purposes.

This method calls :py:func:`PIL.ImageShow.show` internally. You can use
:py:func:`PIL.ImageShow.register` to override its default behaviour.
:py:func:`PIL.ImageShow.register` to override its default behavior.

The image is first saved to a temporary file. By default, it will be in
PNG format.
Expand Down Expand Up @@ -3193,7 +3193,7 @@ def new(
:param size: A 2-tuple, containing (width, height) in pixels.
:param color: What color to use for the image. Default is black. If given,
this should be a single integer or floating point value for single-band
modes, and a tuple for multi-band modes (one value per band). When
modes, and a tuple for multiband modes (one value per band). When
creating RGB or HSV images, you can also use color strings as supported
by the ImageColor module. See :ref:`colors` for more information. If the
color is None, the image is not initialised.
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageCms.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class ImageCmsProfile:
def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None:
"""
:param profile: Either a string representing a filename,
a file like object containing a profile or a
a file-like object containing a profile or a
low-level profile object

"""
Expand Down
6 changes: 3 additions & 3 deletions src/PIL/ImageColor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# The Python Imaging Library
# $Id$
#
# map CSS3-style colour description strings to RGB
# map CSS3-style color description strings to RGB
#
# History:
# 2002-10-24 fl Added support for CSS-style color strings
Expand Down Expand Up @@ -166,9 +166,9 @@ def getcolor(color: str, mode: str) -> int | tuple[int, ...]:


colormap: dict[str, str | tuple[int, int, int]] = {
# X11 colour table from https://drafts.csswg.org/css-color-4/, with
# X11 color table from https://drafts.csswg.org/css-color-4/, with
# gray/grey spelling issues fixed. This is a superset of HTML 4.0
# colour names used in CSS 1.
# color names used in CSS 1.
"aliceblue": "#f0f8ff",
"antiquewhite": "#faebd7",
"aqua": "#00ffff",
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/ImageEnhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def enhance(self, factor: float) -> Image.Image:
class Color(_Enhance):
"""Adjust image color balance.

This class can be used to adjust the colour balance of an image, in
a manner similar to the controls on a colour TV set. An enhancement
This class can be used to adjust the color balance of an image, in
a manner similar to the controls on a color TV set. An enhancement
factor of 0.0 gives a black and white image. A factor of 1.0 gives
the original image.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
MAXBLOCK = 65536
"""
By default, Pillow processes image data in blocks. This helps to prevent excessive use
of resources. Codecs may disable this behaviour with ``_pulls_fd`` or ``_pushes_fd``.
of resources. Codecs may disable this behavior with ``_pulls_fd`` or ``_pushes_fd``.

When reading an image, this is the number of bytes to read at once.

Expand Down
4 changes: 2 additions & 2 deletions src/PIL/ImageMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def lambda_eval(expression: Callable[[dict[str, Any]], Any], **kw: Any) -> Any:
"""
Returns the result of an image function.

:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multiband
images, use the :py:meth:`~PIL.Image.Image.split` method or
:py:func:`~PIL.Image.merge` function.

Expand Down Expand Up @@ -271,7 +271,7 @@ def unsafe_eval(expression: str, **kw: Any) -> Any:
recommended to process expressions without considering this.
:py:meth:`~lambda_eval` is a more secure alternative.

:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multiband
images, use the :py:meth:`~PIL.Image.Image.split` method or
:py:func:`~PIL.Image.merge` function.

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageTk.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class BitmapImage:
transparent. Options, if any, are passed on to Tkinter. The most commonly
used option is ``foreground``, which is used to specify the color for the
non-transparent parts. See the Tkinter documentation for information on
how to specify colours.
how to specify colors.

:param image: A PIL image.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageWin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Dib:

If the display requires a palette, this constructor creates a suitable
palette and associates it with the image. For an "L" image, 128 graylevels
are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together
are allocated. For an "RGB" image, a 6x6x6 color cube is used, together
with 20 graylevels.

To make sure that palettes work properly under Windows, you must call the
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/JpegImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def COM(self: JpegImageFile, marker: int) -> None:
def SOF(self: JpegImageFile, marker: int) -> None:
#
# Start of frame marker. Defines the size and mode of the
# image. JPEG is colour blind, so we use some simple
# image. JPEG is color blind, so we use some simple
# heuristics to map the number of layers to an appropriate
# mode. Note that this could be made a bit brighter, by
# looking for JFIF and Adobe APP markers.
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/PcxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
)

if im.mode == "P":
# colour palette
# color palette
fp.write(o8(12))
palette = im.im.getpalette("RGB", "RGB")
palette += b"\x00" * (768 - len(palette))
Expand Down
Loading