mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 09:56:17 +03:00
Merge pull request #6557 from radarhere/enums
This commit is contained in:
commit
d843759ca9
|
@ -53,9 +53,9 @@ Functions
|
||||||
To protect against potential DOS attacks caused by "`decompression bombs`_" (i.e. malicious files
|
To protect against potential DOS attacks caused by "`decompression bombs`_" (i.e. malicious files
|
||||||
which decompress into a huge amount of data and are designed to crash or cause disruption by using up
|
which decompress into a huge amount of data and are designed to crash or cause disruption by using up
|
||||||
a lot of memory), Pillow will issue a ``DecompressionBombWarning`` if the number of pixels in an
|
a lot of memory), Pillow will issue a ``DecompressionBombWarning`` if the number of pixels in an
|
||||||
image is over a certain limit, :py:data:`PIL.Image.MAX_IMAGE_PIXELS`.
|
image is over a certain limit, :py:data:`MAX_IMAGE_PIXELS`.
|
||||||
|
|
||||||
This threshold can be changed by setting :py:data:`PIL.Image.MAX_IMAGE_PIXELS`. It can be disabled
|
This threshold can be changed by setting :py:data:`MAX_IMAGE_PIXELS`. It can be disabled
|
||||||
by setting ``Image.MAX_IMAGE_PIXELS = None``.
|
by setting ``Image.MAX_IMAGE_PIXELS = None``.
|
||||||
|
|
||||||
If desired, the warning can be turned into an error with
|
If desired, the warning can be turned into an error with
|
||||||
|
@ -63,7 +63,7 @@ Functions
|
||||||
``warnings.simplefilter('ignore', Image.DecompressionBombWarning)``. See also
|
``warnings.simplefilter('ignore', Image.DecompressionBombWarning)``. See also
|
||||||
`the logging documentation`_ to have warnings output to the logging facility instead of stderr.
|
`the logging documentation`_ to have warnings output to the logging facility instead of stderr.
|
||||||
|
|
||||||
If the number of pixels is greater than twice :py:data:`PIL.Image.MAX_IMAGE_PIXELS`, then a
|
If the number of pixels is greater than twice :py:data:`MAX_IMAGE_PIXELS`, then a
|
||||||
``DecompressionBombError`` will be raised instead.
|
``DecompressionBombError`` will be raised instead.
|
||||||
|
|
||||||
.. _decompression bombs: https://en.wikipedia.org/wiki/Zip_bomb
|
.. _decompression bombs: https://en.wikipedia.org/wiki/Zip_bomb
|
||||||
|
@ -255,7 +255,7 @@ This rotates the input image by ``theta`` degrees counter clockwise:
|
||||||
.. automethod:: PIL.Image.Image.transform
|
.. automethod:: PIL.Image.Image.transform
|
||||||
.. automethod:: PIL.Image.Image.transpose
|
.. automethod:: PIL.Image.Image.transpose
|
||||||
|
|
||||||
This flips the input image by using the :data:`PIL.Image.Transpose.FLIP_LEFT_RIGHT`
|
This flips the input image by using the :data:`Transpose.FLIP_LEFT_RIGHT`
|
||||||
method.
|
method.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
|
@ -1989,18 +1989,14 @@ class Image:
|
||||||
:param size: The requested size in pixels, as a 2-tuple:
|
:param size: The requested size in pixels, as a 2-tuple:
|
||||||
(width, height).
|
(width, height).
|
||||||
:param resample: An optional resampling filter. This can be
|
:param resample: An optional resampling filter. This can be
|
||||||
one of :py:data:`PIL.Image.Resampling.NEAREST`,
|
one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
|
||||||
:py:data:`PIL.Image.Resampling.BOX`,
|
:py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
|
||||||
:py:data:`PIL.Image.Resampling.BILINEAR`,
|
:py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`.
|
||||||
:py:data:`PIL.Image.Resampling.HAMMING`,
|
|
||||||
:py:data:`PIL.Image.Resampling.BICUBIC` or
|
|
||||||
:py:data:`PIL.Image.Resampling.LANCZOS`.
|
|
||||||
If the image has mode "1" or "P", it is always set to
|
If the image has mode "1" or "P", it is always set to
|
||||||
:py:data:`PIL.Image.Resampling.NEAREST`.
|
:py:data:`Resampling.NEAREST`. If the image mode specifies a number
|
||||||
If the image mode specifies a number of bits, such as "I;16", then the
|
of bits, such as "I;16", then the default filter is
|
||||||
default filter is :py:data:`PIL.Image.Resampling.NEAREST`.
|
:py:data:`Resampling.NEAREST`. Otherwise, the default filter is
|
||||||
Otherwise, the default filter is
|
:py:data:`Resampling.BICUBIC`. See: :ref:`concept-filters`.
|
||||||
:py:data:`PIL.Image.Resampling.BICUBIC`. See: :ref:`concept-filters`.
|
|
||||||
:param box: An optional 4-tuple of floats providing
|
:param box: An optional 4-tuple of floats providing
|
||||||
the source image region to be scaled.
|
the source image region to be scaled.
|
||||||
The values must be within (0, 0, width, height) rectangle.
|
The values must be within (0, 0, width, height) rectangle.
|
||||||
|
@ -2140,12 +2136,12 @@ class Image:
|
||||||
|
|
||||||
:param angle: In degrees counter clockwise.
|
:param angle: In degrees counter clockwise.
|
||||||
:param resample: An optional resampling filter. This can be
|
:param resample: An optional resampling filter. This can be
|
||||||
one of :py:data:`PIL.Image.Resampling.NEAREST` (use nearest neighbour),
|
one of :py:data:`Resampling.NEAREST` (use nearest neighbour),
|
||||||
:py:data:`PIL.Image.BILINEAR` (linear interpolation in a 2x2
|
:py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
|
||||||
environment), or :py:data:`PIL.Image.Resampling.BICUBIC`
|
environment), or :py:data:`Resampling.BICUBIC` (cubic spline
|
||||||
(cubic spline interpolation in a 4x4 environment).
|
interpolation in a 4x4 environment). If omitted, or if the image has
|
||||||
If omitted, or if the image has mode "1" or "P", it is
|
mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`.
|
||||||
set to :py:data:`PIL.Image.Resampling.NEAREST`. See :ref:`concept-filters`.
|
See :ref:`concept-filters`.
|
||||||
:param expand: Optional expansion flag. If true, expands the output
|
:param expand: Optional expansion flag. If true, expands the output
|
||||||
image to make it large enough to hold the entire rotated image.
|
image to make it large enough to hold the entire rotated image.
|
||||||
If false or omitted, make the output image the same size as the
|
If false or omitted, make the output image the same size as the
|
||||||
|
@ -2452,14 +2448,11 @@ class Image:
|
||||||
|
|
||||||
:param size: Requested size.
|
:param size: Requested size.
|
||||||
:param resample: Optional resampling filter. This can be one
|
:param resample: Optional resampling filter. This can be one
|
||||||
of :py:data:`PIL.Image.Resampling.NEAREST`,
|
of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
|
||||||
:py:data:`PIL.Image.Resampling.BOX`,
|
:py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
|
||||||
:py:data:`PIL.Image.Resampling.BILINEAR`,
|
:py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`.
|
||||||
:py:data:`PIL.Image.Resampling.HAMMING`,
|
If omitted, it defaults to :py:data:`Resampling.BICUBIC`.
|
||||||
:py:data:`PIL.Image.Resampling.BICUBIC` or
|
(was :py:data:`Resampling.NEAREST` prior to version 2.5.0).
|
||||||
:py:data:`PIL.Image.Resampling.LANCZOS`.
|
|
||||||
If omitted, it defaults to :py:data:`PIL.Image.Resampling.BICUBIC`.
|
|
||||||
(was :py:data:`PIL.Image.Resampling.NEAREST` prior to version 2.5.0).
|
|
||||||
See: :ref:`concept-filters`.
|
See: :ref:`concept-filters`.
|
||||||
:param reducing_gap: Apply optimization by resizing the image
|
:param reducing_gap: Apply optimization by resizing the image
|
||||||
in two steps. First, reducing the image by integer times
|
in two steps. First, reducing the image by integer times
|
||||||
|
@ -2530,11 +2523,11 @@ class Image:
|
||||||
|
|
||||||
:param size: The output size.
|
:param size: The output size.
|
||||||
:param method: The transformation method. This is one of
|
:param method: The transformation method. This is one of
|
||||||
:py:data:`PIL.Image.Transform.EXTENT` (cut out a rectangular subregion),
|
:py:data:`Transform.EXTENT` (cut out a rectangular subregion),
|
||||||
:py:data:`PIL.Image.Transform.AFFINE` (affine transform),
|
:py:data:`Transform.AFFINE` (affine transform),
|
||||||
:py:data:`PIL.Image.Transform.PERSPECTIVE` (perspective transform),
|
:py:data:`Transform.PERSPECTIVE` (perspective transform),
|
||||||
:py:data:`PIL.Image.Transform.QUAD` (map a quadrilateral to a rectangle), or
|
:py:data:`Transform.QUAD` (map a quadrilateral to a rectangle), or
|
||||||
:py:data:`PIL.Image.Transform.MESH` (map a number of source quadrilaterals
|
:py:data:`Transform.MESH` (map a number of source quadrilaterals
|
||||||
in one operation).
|
in one operation).
|
||||||
|
|
||||||
It may also be an :py:class:`~PIL.Image.ImageTransformHandler`
|
It may also be an :py:class:`~PIL.Image.ImageTransformHandler`
|
||||||
|
@ -2554,11 +2547,11 @@ class Image:
|
||||||
return method, data
|
return method, data
|
||||||
:param data: Extra data to the transformation method.
|
:param data: Extra data to the transformation method.
|
||||||
:param resample: Optional resampling filter. It can be one of
|
:param resample: Optional resampling filter. It can be one of
|
||||||
:py:data:`PIL.Image.Resampling.NEAREST` (use nearest neighbour),
|
:py:data:`Resampling.NEAREST` (use nearest neighbour),
|
||||||
:py:data:`PIL.Image.Resampling.BILINEAR` (linear interpolation in a 2x2
|
:py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
|
||||||
environment), or :py:data:`PIL.Image.BICUBIC` (cubic spline
|
environment), or :py:data:`Resampling.BICUBIC` (cubic spline
|
||||||
interpolation in a 4x4 environment). If omitted, or if the image
|
interpolation in a 4x4 environment). If omitted, or if the image
|
||||||
has mode "1" or "P", it is set to :py:data:`PIL.Image.Resampling.NEAREST`.
|
has mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`.
|
||||||
See: :ref:`concept-filters`.
|
See: :ref:`concept-filters`.
|
||||||
:param fill: If ``method`` is an
|
:param fill: If ``method`` is an
|
||||||
:py:class:`~PIL.Image.ImageTransformHandler` object, this is one of
|
:py:class:`~PIL.Image.ImageTransformHandler` object, this is one of
|
||||||
|
@ -2685,13 +2678,10 @@ class Image:
|
||||||
"""
|
"""
|
||||||
Transpose image (flip or rotate in 90 degree steps)
|
Transpose image (flip or rotate in 90 degree steps)
|
||||||
|
|
||||||
:param method: One of :py:data:`PIL.Image.Transpose.FLIP_LEFT_RIGHT`,
|
:param method: One of :py:data:`Transpose.FLIP_LEFT_RIGHT`,
|
||||||
:py:data:`PIL.Image.Transpose.FLIP_TOP_BOTTOM`,
|
:py:data:`Transpose.FLIP_TOP_BOTTOM`, :py:data:`Transpose.ROTATE_90`,
|
||||||
:py:data:`PIL.Image.Transpose.ROTATE_90`,
|
:py:data:`Transpose.ROTATE_180`, :py:data:`Transpose.ROTATE_270`,
|
||||||
:py:data:`PIL.Image.Transpose.ROTATE_180`,
|
:py:data:`Transpose.TRANSPOSE` or :py:data:`Transpose.TRANSVERSE`.
|
||||||
:py:data:`PIL.Image.Transpose.ROTATE_270`,
|
|
||||||
:py:data:`PIL.Image.Transpose.TRANSPOSE` or
|
|
||||||
:py:data:`PIL.Image.Transpose.TRANSVERSE`.
|
|
||||||
:returns: Returns a flipped or rotated copy of this image.
|
:returns: Returns a flipped or rotated copy of this image.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user