Python「PIL」:调整图片大小

您所在的位置:网站首页 图像大小怎么修改Python Python「PIL」:调整图片大小

Python「PIL」:调整图片大小

2024-07-12 02:49| 来源: 网络整理| 查看: 265

def resize(self, size, resample=BICUBIC, box=None, reducing_gap=None):     """    Returns a resized copy of this image.     返回此图像的大小调整后的副本。

    :param size: The requested size in pixels, as a 2-tuple:        (width, height).      param size: 请求的大小(以像素为单位),是一个二元数组:(width, height)     :param resample: An optional resampling filter.  This can be        one of :py:attr:`PIL.Image.NEAREST`, :py:attr:`PIL.Image.BOX`,        :py:attr:`PIL.Image.BILINEAR`, :py:attr:`PIL.Image.HAMMING`,        :py:attr:`PIL.Image.BICUBIC` or :py:attr:`PIL.Image.LANCZOS`.        Default filter is :py:attr:`PIL.Image.BICUBIC`.        If the image has mode "1" or "P", it is        always set to :py:attr:`PIL.Image.NEAREST`.        See: :ref:`concept-filters`.     param resample: 一个可选的重采样过滤器。     :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.      param box: 可选的4元浮点数,提供要缩放的源映像区域。     :param reducing_gap: Apply optimization by resizing the image        in two steps. First, reducing the image by integer times        using :py:meth:`~PIL.Image.Image.reduce`.        Second, resizing using regular resampling. The last step        changes size no less than by ``reducing_gap`` times.        ``reducing_gap`` may be None (no first step is performed)        or should be greater than 1.0. The bigger ``reducing_gap``,        the closer the result to the fair resampling.        The smaller ``reducing_gap``, the faster resizing.        With ``reducing_gap`` greater or equal to 3.0, the result is        indistinguishable from fair resampling in most cases.        The default value is None (no optimization).      param reducing_gap: 通过两个步骤调整图像大小来应用优化。     :returns: An :py:class:`~PIL.Image.Image` object.     returns: 返回一个 PIL.Image.Image 对象     """



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3