From fb84c546b78cb3ea7fe0e5c50648712ce129dde1 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 26 Mar 2024 06:00:03 +1100 Subject: [PATCH 1/3] Removed references to the "current version" --- docs/handbook/image-file-formats.rst | 5 ++--- docs/reference/ImageFilter.rst | 3 +-- docs/reference/ImagePath.rst | 4 ++-- src/PIL/Image.py | 19 ++++++++----------- src/PIL/ImageFilter.py | 7 +++---- src/_imagingcms.c | 2 +- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 54f983b69c8..b49a41a0ec9 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -1355,9 +1355,8 @@ The :py:meth:`~PIL.Image.open` method sets the following FPX ^^^ -Pillow reads Kodak FlashPix files. In the current version, only the highest -resolution image is read from the file, and the viewing transform is not taken -into account. +Pillow reads Kodak FlashPix files. Only the highest resolution image is read from the +file, and the viewing transform is not taken into account. To enable FPX support, you must install :pypi:`olefile`. diff --git a/docs/reference/ImageFilter.rst b/docs/reference/ImageFilter.rst index 044aede6264..5f2b6af7c10 100644 --- a/docs/reference/ImageFilter.rst +++ b/docs/reference/ImageFilter.rst @@ -23,8 +23,7 @@ Example: Filter an image Filters ------- -The current version of the library provides the following set of predefined -image enhancement filters: +Pillow provides the following set of predefined image enhancement filters: * **BLUR** * **CONTOUR** diff --git a/docs/reference/ImagePath.rst b/docs/reference/ImagePath.rst index 500096ef7dc..23544b613a0 100644 --- a/docs/reference/ImagePath.rst +++ b/docs/reference/ImagePath.rst @@ -21,8 +21,8 @@ vector data. Path objects can be passed to the methods on the The path object implements most parts of the Python sequence interface, and behaves like a list of (x, y) pairs. You can use len(), item access, and - slicing as usual. However, the current version does not support slice - assignment, or item and slice deletion. + slicing as usual. However, this does not support slice assignment, or item + and slice deletion. :param xy: A sequence. The sequence can contain 2-tuples [(x, y), ...] or a flat list of numbers [x, y, ...]. diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 59c5c36f3b6..24fc94de93e 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -894,9 +894,8 @@ def convert( omitted, a mode is chosen so that all information in the image and the palette can be represented without a palette. - The current version supports all possible conversions between - "L", "RGB" and "CMYK". The ``matrix`` argument only supports "L" - and "RGB". + This supports all possible conversions between "L", "RGB" and "CMYK". The + ``matrix`` argument only supports "L" and "RGB". When translating a color image to grayscale (mode "L"), the library uses the ITU-R 601-2 luma transform:: @@ -1824,9 +1823,8 @@ def point(self, lut, mode: str | None = None) -> Image: class Example(Image.ImagePointHandler): def point(self, data): # Return result - :param mode: Output mode (default is same as input). In the - current version, this can only be used if the source image - has mode "L" or "P", and the output has mode "1" or the + :param mode: Output mode (default is same as input). This can only be used if + the source image has mode "L" or "P", and the output has mode "1" or the source image mode is "I" and the output mode is "L". :returns: An :py:class:`~PIL.Image.Image` object. """ @@ -3020,11 +3018,10 @@ def frombuffer(mode, size, data, decoder_name="raw", *args): If you have an entire image file in a string, wrap it in a :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it. - In the current version, the default parameters used for the "raw" decoder - differs from that used for :py:func:`~PIL.Image.frombytes`. This is a - bug, and will probably be fixed in a future release. The current release - issues a warning if you do this; to disable the warning, you should provide - the full set of parameters. See below for details. + The default parameters used for the "raw" decoder differs from that used for + :py:func:`~PIL.Image.frombytes`. This is a bug, and will probably be fixed in a + future release. The current release issues a warning if you do this; to disable + the warning, you should provide the full set of parameters. See below for details. :param mode: The image mode. See: :ref:`concept-modes`. :param size: The image size. diff --git a/src/PIL/ImageFilter.py b/src/PIL/ImageFilter.py index 035b83c4d77..a6dab3f20fd 100644 --- a/src/PIL/ImageFilter.py +++ b/src/PIL/ImageFilter.py @@ -37,11 +37,10 @@ def filter(self, image): class Kernel(BuiltinFilter): """ - Create a convolution kernel. The current version only - supports 3x3 and 5x5 integer and floating point kernels. + Create a convolution kernel. This only supports 3x3 and 5x5 integer and floating + point kernels. - In the current version, kernels can only be applied to - "L" and "RGB" images. + Kernels can only be applied to "L" and "RGB" images. :param size: Kernel size, given as (width, height). In the current version, this must be (3,3) or (5,5). diff --git a/src/_imagingcms.c b/src/_imagingcms.c index 56d5d73f83c..c7728770a3e 100644 --- a/src/_imagingcms.c +++ b/src/_imagingcms.c @@ -52,7 +52,7 @@ kevin@cazabon.com\n\ */ -/* known to-do list with current version: +/* known to-do list: Verify that PILmode->littleCMStype conversion in findLCMStype is correct for all PIL modes (it probably isn't for the more obscure ones) From 9d101bffebcf2dbaf37e79461019d9505f1d907c Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Tue, 26 Mar 2024 06:07:39 +1100 Subject: [PATCH 2/3] Removed reference to "current version" Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- src/PIL/ImageFilter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PIL/ImageFilter.py b/src/PIL/ImageFilter.py index a6dab3f20fd..2ae5b8a1ac2 100644 --- a/src/PIL/ImageFilter.py +++ b/src/PIL/ImageFilter.py @@ -42,8 +42,8 @@ class Kernel(BuiltinFilter): Kernels can only be applied to "L" and "RGB" images. - :param size: Kernel size, given as (width, height). In the current - version, this must be (3,3) or (5,5). + :param size: Kernel size, given as (width, height). + This must be (3,3) or (5,5). :param kernel: A sequence containing kernel weights. The kernel will be flipped vertically before being applied to the image. :param scale: Scale factor. If given, the result for each pixel is From 2c6258bee5fd178bd129833c831c9883b097bf28 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 26 Mar 2024 06:08:10 +1100 Subject: [PATCH 3/3] Updated indents --- src/PIL/ImageFilter.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/PIL/ImageFilter.py b/src/PIL/ImageFilter.py index 2ae5b8a1ac2..b2c4950d6a9 100644 --- a/src/PIL/ImageFilter.py +++ b/src/PIL/ImageFilter.py @@ -42,15 +42,13 @@ class Kernel(BuiltinFilter): Kernels can only be applied to "L" and "RGB" images. - :param size: Kernel size, given as (width, height). - This must be (3,3) or (5,5). - :param kernel: A sequence containing kernel weights. The kernel will - be flipped vertically before being applied to the image. - :param scale: Scale factor. If given, the result for each pixel is - divided by this value. The default is the sum of the - kernel weights. - :param offset: Offset. If given, this value is added to the result, - after it has been divided by the scale factor. + :param size: Kernel size, given as (width, height). This must be (3,3) or (5,5). + :param kernel: A sequence containing kernel weights. The kernel will be flipped + vertically before being applied to the image. + :param scale: Scale factor. If given, the result for each pixel is divided by this + value. The default is the sum of the kernel weights. + :param offset: Offset. If given, this value is added to the result, after it has + been divided by the scale factor. """ name = "Kernel"