This commit is contained in:
Alexander 2019-12-27 14:27:37 +03:00
parent dda5558129
commit fc0248869c
2 changed files with 12 additions and 12 deletions

View File

@ -94,7 +94,7 @@ class TestImageReduce(PillowTestCase):
# rotate previous image
band = bands[-1].transpose(Image.ROTATE_90)
bands.append(band)
# Correct alpha channel to exclude completely transparent pixels.
# Correct alpha channel by transforming completely transparent pixels.
# Low alpha values also emphasize error after alpha multiplication.
if mode.endswith("A"):
bands[-1] = bands[-1].point(lambda x: int(85 + x / 1.5))
@ -102,7 +102,7 @@ class TestImageReduce(PillowTestCase):
else:
assert len(mode_info.bands) == 1
im = self.gradients_image.convert(mode)
# change the height to make a not square image
# change the height to make a not-square image
return im.crop((0, 0, im.width, im.height - 5))
def compare_reduce_with_box(self, im, factor):
@ -196,7 +196,7 @@ class TestImageReduce(PillowTestCase):
for factor in self.remarkable_factors:
self.compare_reduce_with_reference(im, factor, 0.8, 5)
# With opaque alpha, error should be way smaller
# With opaque alpha, an error should be way smaller.
im.putalpha(Image.new("L", im.size, 255))
for factor in self.remarkable_factors:
self.compare_reduce_with_reference(im, factor)
@ -219,7 +219,7 @@ class TestImageReduce(PillowTestCase):
for factor in self.remarkable_factors:
self.compare_reduce_with_reference(im, factor, 0.8, 5)
# With opaque alpha, error should be way smaller
# With opaque alpha, an error should be way smaller.
im.putalpha(Image.new("L", im.size, 255))
for factor in self.remarkable_factors:
self.compare_reduce_with_reference(im, factor)

View File

@ -1777,9 +1777,9 @@ class Image:
If the image has mode "1" or "P", it is
always set to :py:attr:`PIL.Image.NEAREST`.
See: :ref:`concept-filters`.
:param box: An optional 4-tuple of floats giving the region
of the source image which should be scaled.
The values should be within (0, 0, width, height) rectangle.
:param box: An optional 4-tuple of floats providing
the source image region to be scaled.
The values must be within (0, 0, width, height) rectangle.
If omitted or None, the entire source is used.
:returns: An :py:class:`~PIL.Image.Image` object.
"""
@ -1826,15 +1826,15 @@ class Image:
def reduce(self, factor, box=None):
"""
Returns reduced in `factor` times copy of the image.
Returns a copy of the image reduced by `factor` times.
If the size of the image is not dividable by the `factor`,
the resulting size will be rounded up.
:param factor: A greater than 0 integer or tuple of two integers
for width and height separately.
:param box: An optional 4-tuple of ints giving the region
of the source image which should be reduced.
The values should be within (0, 0, width, height) rectangle.
for width and height separately.
:param box: An optional 4-tuple of ints providing
the source image region to be reduced.
The values must be within (0, 0, width, height) rectangle.
If omitted or None, the entire source is used.
"""
if not isinstance(factor, (list, tuple)):