diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index e3fcec49084..4c4f601313e 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -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) diff --git a/Tests/test_file_tiff_metadata.py b/Tests/test_file_tiff_metadata.py index 322ef5abcc5..ea85440fe76 100644 --- a/Tests/test_file_tiff_metadata.py +++ b/Tests/test_file_tiff_metadata.py @@ -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 diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py index 547a6c2c678..a7b3246331e 100644 --- a/Tests/test_image_convert.py +++ b/Tests/test_image_convert.py @@ -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 diff --git a/Tests/test_image_resize.py b/Tests/test_image_resize.py index 3e8979a5b11..b7a09a8e83f 100644 --- a/Tests/test_image_resize.py +++ b/Tests/test_image_resize.py @@ -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)) diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py index 3bcb7b90178..631b1b41310 100644 --- a/Tests/test_imagedraw.py +++ b/Tests/test_imagedraw.py @@ -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) diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 294c2b9eb38..f3935a1f8ca 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -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. @@ -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. diff --git a/docs/handbook/tutorial.rst b/docs/handbook/tutorial.rst index d9efeae8950..f43347982a1 100644 --- a/docs/handbook/tutorial.rst +++ b/docs/handbook/tutorial.rst @@ -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: diff --git a/docs/handbook/writing-your-own-image-plugin.rst b/docs/handbook/writing-your-own-image-plugin.rst index aef7a50cef9..31ed056c80f 100644 --- a/docs/handbook/writing-your-own-image-plugin.rst +++ b/docs/handbook/writing-your-own-image-plugin.rst @@ -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. diff --git a/docs/reference/ImageFilter.rst b/docs/reference/ImageFilter.rst index d5146bc491f..066d127b49b 100644 --- a/docs/reference/ImageFilter.rst +++ b/docs/reference/ImageFilter.rst @@ -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. diff --git a/docs/reference/ImageMath.rst b/docs/reference/ImageMath.rst index 0ee49b15008..17db4e7cb01 100644 --- a/docs/reference/ImageMath.rst +++ b/docs/reference/ImageMath.rst @@ -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. @@ -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. diff --git a/docs/reference/PixelAccess.rst b/docs/reference/PixelAccess.rst index 831de9d36b7..7ad4cae88bf 100644 --- a/docs/reference/PixelAccess.rst +++ b/docs/reference/PixelAccess.rst @@ -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, diff --git a/docs/releasenotes/3.0.0.rst b/docs/releasenotes/3.0.0.rst index dcd8031f588..67024c2555a 100644 --- a/docs/releasenotes/3.0.0.rst +++ b/docs/releasenotes/3.0.0.rst @@ -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. diff --git a/docs/releasenotes/7.2.0.rst b/docs/releasenotes/7.2.0.rst index 12bafa8ce90..006fdacb83c 100644 --- a/docs/releasenotes/7.2.0.rst +++ b/docs/releasenotes/7.2.0.rst @@ -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 diff --git a/docs/releasenotes/8.2.0.rst b/docs/releasenotes/8.2.0.rst index a59560695eb..c9d1677a1fa 100644 --- a/docs/releasenotes/8.2.0.rst +++ b/docs/releasenotes/8.2.0.rst @@ -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. @@ -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 @@ -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 diff --git a/docs/releasenotes/9.0.0.rst b/docs/releasenotes/9.0.0.rst index 660e5514cf8..17d6a8c2b13 100644 --- a/docs/releasenotes/9.0.0.rst +++ b/docs/releasenotes/9.0.0.rst @@ -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 diff --git a/docs/releasenotes/9.1.0.rst b/docs/releasenotes/9.1.0.rst index 72749ce8c54..f094e865187 100644 --- a/docs/releasenotes/9.1.0.rst +++ b/docs/releasenotes/9.1.0.rst @@ -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 diff --git a/docs/releasenotes/9.3.0.rst b/docs/releasenotes/9.3.0.rst index bb1e731fd75..3655429c357 100644 --- a/docs/releasenotes/9.3.0.rst +++ b/docs/releasenotes/9.3.0.rst @@ -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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/PIL/FpxImagePlugin.py b/src/PIL/FpxImagePlugin.py index 0b06aac965f..043fec98496 100644 --- a/src/PIL/FpxImagePlugin.py +++ b/src/PIL/FpxImagePlugin.py @@ -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"), diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 76a0d4ab99f..c91e4e1cbb9 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -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) @@ -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) @@ -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 diff --git a/src/PIL/Image.py b/src/PIL/Image.py index cc431a86a5d..beb91db0731 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -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. """ @@ -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, @@ -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 @@ -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. @@ -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. diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index 513e28acf33..25a9f655b84 100644 --- a/src/PIL/ImageCms.py +++ b/src/PIL/ImageCms.py @@ -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 """ diff --git a/src/PIL/ImageColor.py b/src/PIL/ImageColor.py index 9a15a8eb759..541ab2d51dd 100644 --- a/src/PIL/ImageColor.py +++ b/src/PIL/ImageColor.py @@ -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 @@ -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", diff --git a/src/PIL/ImageEnhance.py b/src/PIL/ImageEnhance.py index 0e7e6dd8ae6..cce4b9d78fc 100644 --- a/src/PIL/ImageEnhance.py +++ b/src/PIL/ImageEnhance.py @@ -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. """ diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index 34143543733..41646990c1a 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -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. diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index dfdc50c0552..38248b39e0a 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -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. @@ -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. diff --git a/src/PIL/ImageTk.py b/src/PIL/ImageTk.py index 3a4cb81e9ef..66b155a6a05 100644 --- a/src/PIL/ImageTk.py +++ b/src/PIL/ImageTk.py @@ -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. """ diff --git a/src/PIL/ImageWin.py b/src/PIL/ImageWin.py index 98c28f29f1d..38f2eaa090d 100644 --- a/src/PIL/ImageWin.py +++ b/src/PIL/ImageWin.py @@ -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 diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index 894c1547d7b..c181cf964c6 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -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. diff --git a/src/PIL/PcxImagePlugin.py b/src/PIL/PcxImagePlugin.py index 6b16d538537..1d892000573 100644 --- a/src/PIL/PcxImagePlugin.py +++ b/src/PIL/PcxImagePlugin.py @@ -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)) diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py index 9826a4cd148..a9727ee9194 100644 --- a/src/PIL/PngImagePlugin.py +++ b/src/PIL/PngImagePlugin.py @@ -74,10 +74,10 @@ (4, 0): ("L", "L;4"), (8, 0): ("L", "L"), (16, 0): ("I;16", "I;16B"), - # Truecolour + # Truecolor (8, 2): ("RGB", "RGB"), (16, 2): ("RGB", "RGB;16B"), - # Indexed-colour + # Indexed-color (1, 3): ("P", "P;1"), (2, 3): ("P", "P;2"), (4, 3): ("P", "P;4"), @@ -85,7 +85,7 @@ # Grayscale with alpha (8, 4): ("LA", "LA"), (16, 4): ("RGBA", "LA;16B"), # LA;16B->LA not yet available - # Truecolour with alpha + # Truecolor with alpha (8, 6): ("RGBA", "RGBA"), (16, 6): ("RGBA", "RGBA;16B"), } diff --git a/src/PIL/XpmImagePlugin.py b/src/PIL/XpmImagePlugin.py index 3be240fbc1a..c06f5591e57 100644 --- a/src/PIL/XpmImagePlugin.py +++ b/src/PIL/XpmImagePlugin.py @@ -70,7 +70,7 @@ def _open(self) -> None: for i in range(0, len(s), 2): if s[i] == b"c": - # process colour key + # process color key rgb = s[i + 1] if rgb == b"None": self.info["transparency"] = c @@ -82,13 +82,13 @@ def _open(self) -> None: + o8(rgb_int & 255) ) else: - # unknown colour + # unknown color msg = "cannot read this XPM file" raise ValueError(msg) break else: - # missing colour key + # missing color key msg = "cannot read this XPM file" raise ValueError(msg) diff --git a/src/_imaging.c b/src/_imaging.c index d2a195887fa..c6eec00a0b8 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -1723,10 +1723,10 @@ _putdata(ImagingObject *self, PyObject *args) { static PyObject * _quantize(ImagingObject *self, PyObject *args) { - int colours = 256; + int colors = 256; int method = 0; int kmeans = 0; - if (!PyArg_ParseTuple(args, "|iii", &colours, &method, &kmeans)) { + if (!PyArg_ParseTuple(args, "|iii", &colors, &method, &kmeans)) { return NULL; } @@ -1737,7 +1737,7 @@ _quantize(ImagingObject *self, PyObject *args) { ); } - return PyImagingNew(ImagingQuantize(self->image, colours, method, kmeans)); + return PyImagingNew(ImagingQuantize(self->image, colors, method, kmeans)); } static PyObject * diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c index 330e5325c33..e961acf615a 100644 --- a/src/libImaging/Convert.c +++ b/src/libImaging/Convert.c @@ -542,7 +542,7 @@ static void rgb2cmyk(UINT8 *out, const UINT8 *in, int xsize) { int x; for (x = 0; x < xsize; x++) { - /* Note: no undercolour removal */ + /* Note: no undercolor removal */ *out++ = ~(*in++); *out++ = ~(*in++); *out++ = ~(*in++); @@ -1188,7 +1188,7 @@ topalette( palette->palette[i * 4 + 2] = (UINT8)i; } } else { - palette = ImagingPaletteNewBrowser(); /* Standard colour cube */ + palette = ImagingPaletteNewBrowser(); /* Standard color cube */ } } @@ -1222,7 +1222,7 @@ topalette( ImagingSectionLeave(&cookie); } else { - /* colour image */ + /* color image */ /* Create mapping cache */ if (ImagingPaletteCachePrepare(palette) < 0) { @@ -1265,7 +1265,7 @@ topalette( g = CLIP8(in[1] + (g + e[3 + 1]) / 16); b = CLIP8(in[2] + (b + e[3 + 2]) / 16); - /* get closest colour */ + /* get closest color */ cache = &ImagingPaletteCache(palette, r, g, b); if (cache[0] == 0x100) { ImagingPaletteCacheUpdate(palette, r, g, b); @@ -1318,7 +1318,7 @@ topalette( free(errors); } else { - /* closest colour */ + /* closest color */ ImagingSectionEnter(&cookie); for (y = 0; y < imIn->ysize; y++) { int r, g, b; @@ -1332,7 +1332,7 @@ topalette( g = in[1]; b = in[2]; - /* get closest colour */ + /* get closest color */ cache = &ImagingPaletteCache(palette, r, g, b); if (cache[0] == 0x100) { ImagingPaletteCacheUpdate(palette, r, g, b); @@ -1392,7 +1392,7 @@ tobilevel(Imaging imOut, Imaging imIn) { l = l0 = l1 = 0; for (x = 0; x < imIn->xsize; x++) { - /* pick closest colour */ + /* pick closest color */ l = CLIP8(in[x] + (l + errors[x + 1]) / 16); out[x] = (l > 128) ? 255 : 0; @@ -1423,7 +1423,7 @@ tobilevel(Imaging imOut, Imaging imIn) { l = l0 = l1 = 0; for (x = 0; x < imIn->xsize; x++, in += 4) { - /* pick closest colour */ + /* pick closest color */ l = CLIP8(L(in) / 1000 + (l + errors[x + 1]) / 16); out[x] = (l > 128) ? 255 : 0; diff --git a/src/libImaging/Dib.c b/src/libImaging/Dib.c index 2afe71d4ac9..86b01115303 100644 --- a/src/libImaging/Dib.c +++ b/src/libImaging/Dib.c @@ -158,7 +158,7 @@ ImagingNewDIB(const ModeID mode, int xsize, int ysize) { } else if (mode == IMAGING_MODE_RGB) { #ifdef CUBE216 - /* Colour DIB. Create a 6x6x6 colour cube (216 entries) and + /* Color DIB. Create a 6x6x6 color cube (216 entries) and * add 20 extra graylevels for best result with grayscale * images. */ @@ -182,7 +182,7 @@ ImagingNewDIB(const ModeID mode, int xsize, int ysize) { #else - /* Colour DIB. Alternate palette. */ + /* Color DIB. Alternate palette. */ i = 10; for (r = 0; r < 256; r += 37) { @@ -292,7 +292,7 @@ ImagingQueryPaletteDIB(ImagingDIB dib, void *dc) { n = 0; } - return n; /* number of colours that was changed */ + return n; /* number of colors that was changed */ } void diff --git a/src/libImaging/Fill.c b/src/libImaging/Fill.c index cbd303204d5..e399cbe06dd 100644 --- a/src/libImaging/Fill.c +++ b/src/libImaging/Fill.c @@ -20,7 +20,7 @@ #include "math.h" Imaging -ImagingFill(Imaging im, const void *colour) { +ImagingFill(Imaging im, const void *color) { int x, y; ImagingSectionCookie cookie; @@ -35,7 +35,7 @@ ImagingFill(Imaging im, const void *colour) { if (access) { for (y = 0; y < im->ysize; y++) { for (x = 0; x < im->xsize; x++) { - access->put_pixel(im, x, y, colour); + access->put_pixel(im, x, y, color); } } ImagingAccessDelete(im, access); @@ -48,7 +48,7 @@ ImagingFill(Imaging im, const void *colour) { } else { INT32 c = 0L; ImagingSectionEnter(&cookie); - memcpy(&c, colour, im->pixelsize); + memcpy(&c, color, im->pixelsize); if (im->image32 && c != 0L) { for (y = 0; y < im->ysize; y++) { for (x = 0; x < im->xsize; x++) { @@ -56,7 +56,7 @@ ImagingFill(Imaging im, const void *colour) { } } } else { - unsigned char cc = (unsigned char)*(UINT8 *)colour; + unsigned char cc = (unsigned char)*(UINT8 *)color; for (y = 0; y < im->ysize; y++) { memset(im->image[y], cc, im->linesize); } diff --git a/src/libImaging/Imaging.h b/src/libImaging/Imaging.h index f7049c8925c..dfc0c104fe3 100644 --- a/src/libImaging/Imaging.h +++ b/src/libImaging/Imaging.h @@ -86,7 +86,7 @@ struct ImagingMemoryInstance { int xsize; /* Image dimension. */ int ysize; - /* Colour palette (for "P" images only) */ + /* Color palette (for "P" images only) */ ImagingPalette palette; /* Data pointers */ @@ -250,7 +250,7 @@ ImagingPaletteCacheDelete(ImagingPalette palette); p->cache[(r >> 2) + (g >> 2) * 64 + (b >> 2) * 64 * 64] extern Imaging -ImagingQuantize(Imaging im, int colours, int mode, int kmeans); +ImagingQuantize(Imaging im, int colors, int mode, int kmeans); /* Threading */ /* --------- */ diff --git a/src/libImaging/JpegDecode.c b/src/libImaging/JpegDecode.c index ae3274456d3..d8f1340119b 100644 --- a/src/libImaging/JpegDecode.c +++ b/src/libImaging/JpegDecode.c @@ -8,7 +8,7 @@ * 1996-05-02 fl Created * 1996-05-05 fl Handle small JPEG files correctly * 1996-05-28 fl Added "draft mode" support - * 1997-01-25 fl Added colour conversion override + * 1997-01-25 fl Added color conversion override * 1998-01-31 fl Adapted to libjpeg 6a * 1998-07-12 fl Extended YCbCr support * 1998-12-29 fl Added new state to handle suspension in multipass modes diff --git a/src/libImaging/Matrix.c b/src/libImaging/Matrix.c index d28e04edfaa..82edb5e1647 100644 --- a/src/libImaging/Matrix.c +++ b/src/libImaging/Matrix.c @@ -2,7 +2,7 @@ * The Python Imaging Library * $Id$ * - * colour and luminance matrix transforms + * color and luminance matrix transforms * * history: * 1996-05-18 fl: created (brute force implementation) diff --git a/src/libImaging/Pack.c b/src/libImaging/Pack.c index fdf5a72aa9e..d2df854f8f1 100644 --- a/src/libImaging/Pack.c +++ b/src/libImaging/Pack.c @@ -554,7 +554,7 @@ static struct { {IMAGING_MODE_PA, IMAGING_RAWMODE_PA, 16, packLA}, {IMAGING_MODE_PA, IMAGING_RAWMODE_PA_L, 16, packLAL}, - /* true colour */ + /* true color */ {IMAGING_MODE_RGB, IMAGING_RAWMODE_RGB, 24, ImagingPackRGB}, {IMAGING_MODE_RGB, IMAGING_RAWMODE_RGBX, 32, copy4}, {IMAGING_MODE_RGB, IMAGING_RAWMODE_RGBA, 32, copy4}, @@ -567,7 +567,7 @@ static struct { {IMAGING_MODE_RGB, IMAGING_RAWMODE_G, 8, band1}, {IMAGING_MODE_RGB, IMAGING_RAWMODE_B, 8, band2}, - /* true colour w. alpha */ + /* true color w. alpha */ {IMAGING_MODE_RGBA, IMAGING_RAWMODE_RGBA, 32, copy4}, {IMAGING_MODE_RGBA, IMAGING_RAWMODE_RGBA_L, 32, packRGBXL}, {IMAGING_MODE_RGBA, IMAGING_RAWMODE_RGB, 24, ImagingPackRGB}, @@ -580,12 +580,12 @@ static struct { {IMAGING_MODE_RGBA, IMAGING_RAWMODE_B, 8, band2}, {IMAGING_MODE_RGBA, IMAGING_RAWMODE_A, 8, band3}, - /* true colour w. alpha premultiplied */ + /* true color w. alpha premultiplied */ {IMAGING_MODE_RGBa, IMAGING_RAWMODE_RGBa, 32, copy4}, {IMAGING_MODE_RGBa, IMAGING_RAWMODE_BGRa, 32, ImagingPackBGRA}, {IMAGING_MODE_RGBa, IMAGING_RAWMODE_aBGR, 32, ImagingPackABGR}, - /* true colour w. padding */ + /* true color w. padding */ {IMAGING_MODE_RGBX, IMAGING_RAWMODE_RGBX, 32, copy4}, {IMAGING_MODE_RGBX, IMAGING_RAWMODE_RGBX_L, 32, packRGBXL}, {IMAGING_MODE_RGBX, IMAGING_RAWMODE_RGB, 24, ImagingPackRGB}, @@ -597,7 +597,7 @@ static struct { {IMAGING_MODE_RGBX, IMAGING_RAWMODE_B, 8, band2}, {IMAGING_MODE_RGBX, IMAGING_RAWMODE_X, 8, band3}, - /* colour separation */ + /* color separation */ {IMAGING_MODE_CMYK, IMAGING_RAWMODE_CMYK, 32, copy4}, {IMAGING_MODE_CMYK, IMAGING_RAWMODE_CMYK_I, 32, copy4I}, {IMAGING_MODE_CMYK, IMAGING_RAWMODE_CMYK_L, 32, packRGBXL}, diff --git a/src/libImaging/Palette.c b/src/libImaging/Palette.c index 371ba644b50..2010d46273d 100644 --- a/src/libImaging/Palette.c +++ b/src/libImaging/Palette.c @@ -6,7 +6,7 @@ * * history: * 1996-05-05 fl Added to library - * 1996-05-27 fl Added colour mapping stuff + * 1996-05-27 fl Added color mapping stuff * 1997-05-12 fl Support RGBA palettes * 2005-02-09 fl Removed grayscale entries from web palette * @@ -60,7 +60,7 @@ ImagingPaletteNewBrowser(void) { /* FIXME: Add 10-level windows palette here? */ - /* Simple 6x6x6 colour cube */ + /* Simple 6x6x6 color cube */ i = 10; for (b = 0; b < 256; b += 51) { for (g = 0; g < 256; g += 51) { @@ -115,7 +115,7 @@ ImagingPaletteDelete(ImagingPalette palette) { } /* -------------------------------------------------------------------- */ -/* Colour mapping */ +/* Color mapping */ /* -------------------------------------------------------------------- */ /* This code is used to map RGB triplets to palette indices, using @@ -130,7 +130,7 @@ ImagingPaletteDelete(ImagingPalette palette) { #define DIST(a, b, s) (a - b) * (a - b) * s -/* Colour weights (no scaling, for now) */ +/* Color weights (no scaling, for now) */ #define RSCALE 1 #define GSCALE 1 #define BSCALE 1 @@ -160,7 +160,7 @@ ImagingPaletteCacheUpdate(ImagingPalette palette, int r, int g, int b) { UINT8 c[BOXVOLUME]; /* Get box boundaries for the given (r,g,b)-triplet. Each box - covers eight cache slots (32 colour values, that is). */ + covers eight cache slots (32 color values, that is). */ r0 = r & 0xe0; r1 = r0 + 0x1f; @@ -175,7 +175,7 @@ ImagingPaletteCacheUpdate(ImagingPalette palette, int r, int g, int b) { /* Step 1 -- Select relevant palette entries (after Heckbert) */ /* For each palette entry, calculate the min and max distances to - * any position in the box given by the colour we're looking for. */ + * any position in the box given by the color we're looking for. */ dmax = (unsigned int)~0; @@ -270,7 +270,7 @@ ImagingPaletteCacheUpdate(ImagingPalette palette, int r, int g, int b) { int ImagingPaletteCachePrepare(ImagingPalette palette) { - /* Add a colour cache to a palette */ + /* Add a color cache to a palette */ int i; int entries = 64 * 64 * 64; @@ -297,7 +297,7 @@ ImagingPaletteCachePrepare(ImagingPalette palette) { void ImagingPaletteCacheDelete(ImagingPalette palette) { - /* Release the colour cache, if any */ + /* Release the color cache, if any */ if (palette && palette->cache) { free(palette->cache); diff --git a/src/libImaging/Point.c b/src/libImaging/Point.c index 8f6d47c770f..d5bdacb5825 100644 --- a/src/libImaging/Point.c +++ b/src/libImaging/Point.c @@ -6,7 +6,7 @@ * * history: * 1995-11-27 fl Created - * 1996-03-31 fl Fixed colour support + * 1996-03-31 fl Fixed color support * 1996-08-13 fl Support 8-bit to "1" thresholding * 1997-05-31 fl Added floating point transform * 1998-07-02 fl Added integer point transform diff --git a/src/libImaging/Quant.c b/src/libImaging/Quant.c index 7e3df180823..dd57cd44361 100644 --- a/src/libImaging/Quant.c +++ b/src/libImaging/Quant.c @@ -351,7 +351,7 @@ splitlists( #ifdef DEBUG int nLeft; #endif - int splitColourVal; + int splitColorVal; #ifdef DEBUG { @@ -419,9 +419,9 @@ splitlists( } } if (c) { - splitColourVal = c->prev[axis]->p.a.v[axis]; + splitColorVal = c->prev[axis]->p.a.v[axis]; for (; c; c = c->next[axis]) { - if (splitColourVal != c->p.a.v[axis]) { + if (splitColorVal != c->p.a.v[axis]) { break; } c->flag = 0; @@ -437,8 +437,8 @@ splitlists( nCount[1] += c->count; } if (!nRight) { - for (c = t[axis], splitColourVal = t[axis]->p.a.v[axis]; c; c = c->prev[axis]) { - if (splitColourVal != c->p.a.v[axis]) { + for (c = t[axis], splitColorVal = t[axis]->p.a.v[axis]; c; c = c->prev[axis]) { + if (splitColorVal != c->p.a.v[axis]) { break; } c->flag = 1; @@ -1737,7 +1737,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans) { } } else if (im->mode == IMAGING_MODE_RGB || im->mode == IMAGING_MODE_RGBA) { - /* true colour */ + /* true color */ withAlpha = im->mode == IMAGING_MODE_RGBA; int transparency = 0; @@ -1754,7 +1754,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans) { b = p[i].c.b; } else { /* Set all subsequent transparent pixels - to the same colour as the first */ + to the same color as the first */ p[i].c.r = r; p[i].c.g = g; p[i].c.b = b; diff --git a/src/libImaging/Storage.c b/src/libImaging/Storage.c index c09062c92e5..3b89790887b 100644 --- a/src/libImaging/Storage.c +++ b/src/libImaging/Storage.c @@ -141,7 +141,7 @@ ImagingNewPrologueSubtype(const ModeID mode, int xsize, int ysize, int size) { strcpy(im->band_names[0], "I"); } else if (mode == IMAGING_MODE_RGB) { - /* 24-bit true colour images */ + /* 24-bit true color images */ im->bands = 3; im->pixelsize = 4; im->linesize = xsize * 4; @@ -151,7 +151,7 @@ ImagingNewPrologueSubtype(const ModeID mode, int xsize, int ysize, int size) { strcpy(im->band_names[3], "X"); } else if (mode == IMAGING_MODE_RGBX) { - /* 32-bit true colour images with padding */ + /* 32-bit true color images with padding */ im->bands = im->pixelsize = 4; im->linesize = xsize * 4; strcpy(im->band_names[0], "R"); @@ -160,7 +160,7 @@ ImagingNewPrologueSubtype(const ModeID mode, int xsize, int ysize, int size) { strcpy(im->band_names[3], "X"); } else if (mode == IMAGING_MODE_RGBA) { - /* 32-bit true colour images with alpha */ + /* 32-bit true color images with alpha */ im->bands = im->pixelsize = 4; im->linesize = xsize * 4; strcpy(im->band_names[0], "R"); @@ -169,7 +169,7 @@ ImagingNewPrologueSubtype(const ModeID mode, int xsize, int ysize, int size) { strcpy(im->band_names[3], "A"); } else if (mode == IMAGING_MODE_RGBa) { - /* 32-bit true colour images with premultiplied alpha */ + /* 32-bit true color images with premultiplied alpha */ im->bands = im->pixelsize = 4; im->linesize = xsize * 4; strcpy(im->band_names[0], "R"); @@ -178,7 +178,7 @@ ImagingNewPrologueSubtype(const ModeID mode, int xsize, int ysize, int size) { strcpy(im->band_names[3], "a"); } else if (mode == IMAGING_MODE_CMYK) { - /* 32-bit colour separation */ + /* 32-bit color separation */ im->bands = im->pixelsize = 4; im->linesize = xsize * 4; strcpy(im->band_names[0], "C"); diff --git a/src/libImaging/Unpack.c b/src/libImaging/Unpack.c index 203bcac2ca9..643c7d28cbb 100644 --- a/src/libImaging/Unpack.c +++ b/src/libImaging/Unpack.c @@ -1605,7 +1605,7 @@ static struct { {IMAGING_MODE_PA, IMAGING_RAWMODE_PA_L, 16, unpackLAL}, {IMAGING_MODE_PA, IMAGING_RAWMODE_LA, 16, unpackLA}, - /* true colour */ + /* true color */ {IMAGING_MODE_RGB, IMAGING_RAWMODE_RGB, 24, ImagingUnpackRGB}, {IMAGING_MODE_RGB, IMAGING_RAWMODE_RGB_L, 24, unpackRGBL}, {IMAGING_MODE_RGB, IMAGING_RAWMODE_RGB_R, 24, unpackRGBR}, @@ -1642,7 +1642,7 @@ static struct { {IMAGING_MODE_RGB, IMAGING_RAWMODE_B_16B, 16, band216B}, {IMAGING_MODE_RGB, IMAGING_RAWMODE_CMYK, 32, cmyk2rgb}, - /* true colour w. alpha */ + /* true color w. alpha */ {IMAGING_MODE_RGBA, IMAGING_RAWMODE_LA, 16, unpackRGBALA}, {IMAGING_MODE_RGBA, IMAGING_RAWMODE_LA_16B, 32, unpackRGBALA16B}, {IMAGING_MODE_RGBA, IMAGING_RAWMODE_RGBA, 32, copy4}, @@ -1713,13 +1713,13 @@ static struct { {IMAGING_MODE_RGBA, IMAGING_RAWMODE_A_16N, 16, band316L}, #endif - /* true colour w. alpha premultiplied */ + /* true color w. alpha premultiplied */ {IMAGING_MODE_RGBa, IMAGING_RAWMODE_RGBa, 32, copy4}, {IMAGING_MODE_RGBa, IMAGING_RAWMODE_BGRa, 32, unpackBGRA}, {IMAGING_MODE_RGBa, IMAGING_RAWMODE_aRGB, 32, unpackARGB}, {IMAGING_MODE_RGBa, IMAGING_RAWMODE_aBGR, 32, unpackABGR}, - /* true colour w. padding */ + /* true color w. padding */ {IMAGING_MODE_RGBX, IMAGING_RAWMODE_RGB, 24, ImagingUnpackRGB}, {IMAGING_MODE_RGBX, IMAGING_RAWMODE_RGB_L, 24, unpackRGBL}, {IMAGING_MODE_RGBX, IMAGING_RAWMODE_RGB_16B, 48, unpackRGB16B}, @@ -1743,7 +1743,7 @@ static struct { {IMAGING_MODE_RGBX, IMAGING_RAWMODE_B, 8, band2}, {IMAGING_MODE_RGBX, IMAGING_RAWMODE_X, 8, band3}, - /* colour separation */ + /* color separation */ {IMAGING_MODE_CMYK, IMAGING_RAWMODE_CMYK, 32, copy4}, {IMAGING_MODE_CMYK, IMAGING_RAWMODE_CMYKX, 40, copy4skip1}, {IMAGING_MODE_CMYK, IMAGING_RAWMODE_CMYKXX, 48, copy4skip2},