mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
wording
This commit is contained in:
parent
dda5558129
commit
fc0248869c
|
@ -94,7 +94,7 @@ class TestImageReduce(PillowTestCase):
|
||||||
# rotate previous image
|
# rotate previous image
|
||||||
band = bands[-1].transpose(Image.ROTATE_90)
|
band = bands[-1].transpose(Image.ROTATE_90)
|
||||||
bands.append(band)
|
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.
|
# Low alpha values also emphasize error after alpha multiplication.
|
||||||
if mode.endswith("A"):
|
if mode.endswith("A"):
|
||||||
bands[-1] = bands[-1].point(lambda x: int(85 + x / 1.5))
|
bands[-1] = bands[-1].point(lambda x: int(85 + x / 1.5))
|
||||||
|
@ -102,7 +102,7 @@ class TestImageReduce(PillowTestCase):
|
||||||
else:
|
else:
|
||||||
assert len(mode_info.bands) == 1
|
assert len(mode_info.bands) == 1
|
||||||
im = self.gradients_image.convert(mode)
|
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))
|
return im.crop((0, 0, im.width, im.height - 5))
|
||||||
|
|
||||||
def compare_reduce_with_box(self, im, factor):
|
def compare_reduce_with_box(self, im, factor):
|
||||||
|
@ -196,7 +196,7 @@ class TestImageReduce(PillowTestCase):
|
||||||
for factor in self.remarkable_factors:
|
for factor in self.remarkable_factors:
|
||||||
self.compare_reduce_with_reference(im, factor, 0.8, 5)
|
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))
|
im.putalpha(Image.new("L", im.size, 255))
|
||||||
for factor in self.remarkable_factors:
|
for factor in self.remarkable_factors:
|
||||||
self.compare_reduce_with_reference(im, factor)
|
self.compare_reduce_with_reference(im, factor)
|
||||||
|
@ -219,7 +219,7 @@ class TestImageReduce(PillowTestCase):
|
||||||
for factor in self.remarkable_factors:
|
for factor in self.remarkable_factors:
|
||||||
self.compare_reduce_with_reference(im, factor, 0.8, 5)
|
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))
|
im.putalpha(Image.new("L", im.size, 255))
|
||||||
for factor in self.remarkable_factors:
|
for factor in self.remarkable_factors:
|
||||||
self.compare_reduce_with_reference(im, factor)
|
self.compare_reduce_with_reference(im, factor)
|
||||||
|
|
|
@ -1777,9 +1777,9 @@ class Image:
|
||||||
If the image has mode "1" or "P", it is
|
If the image has mode "1" or "P", it is
|
||||||
always set to :py:attr:`PIL.Image.NEAREST`.
|
always set to :py:attr:`PIL.Image.NEAREST`.
|
||||||
See: :ref:`concept-filters`.
|
See: :ref:`concept-filters`.
|
||||||
:param box: An optional 4-tuple of floats giving the region
|
:param box: An optional 4-tuple of floats providing
|
||||||
of the source image which should be scaled.
|
the source image region to be scaled.
|
||||||
The values should be within (0, 0, width, height) rectangle.
|
The values must be within (0, 0, width, height) rectangle.
|
||||||
If omitted or None, the entire source is used.
|
If omitted or None, the entire source is used.
|
||||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||||
"""
|
"""
|
||||||
|
@ -1826,15 +1826,15 @@ class Image:
|
||||||
|
|
||||||
def reduce(self, factor, box=None):
|
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`,
|
If the size of the image is not dividable by the `factor`,
|
||||||
the resulting size will be rounded up.
|
the resulting size will be rounded up.
|
||||||
|
|
||||||
:param factor: A greater than 0 integer or tuple of two integers
|
:param factor: A greater than 0 integer or tuple of two integers
|
||||||
for width and height separately.
|
for width and height separately.
|
||||||
:param box: An optional 4-tuple of ints giving the region
|
:param box: An optional 4-tuple of ints providing
|
||||||
of the source image which should be reduced.
|
the source image region to be reduced.
|
||||||
The values should be within (0, 0, width, height) rectangle.
|
The values must be within (0, 0, width, height) rectangle.
|
||||||
If omitted or None, the entire source is used.
|
If omitted or None, the entire source is used.
|
||||||
"""
|
"""
|
||||||
if not isinstance(factor, (list, tuple)):
|
if not isinstance(factor, (list, tuple)):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user