2018-07-09 17:04:48 +03:00
|
|
|
5.3.0
|
|
|
|
-----
|
|
|
|
|
2018-09-30 17:12:20 +03:00
|
|
|
API Changes
|
|
|
|
===========
|
|
|
|
|
|
|
|
Image size
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
If you attempt to set the size of an image directly, e.g.
|
2023-11-01 21:18:25 +03:00
|
|
|
``im.size = (100, 100)``, you will now receive an :py:exc:`AttributeError`. This is
|
2018-09-30 17:12:20 +03:00
|
|
|
not about removing existing functionality, but instead about raising an
|
|
|
|
explicit error to prevent later consequences. The ``resize`` method is the
|
|
|
|
correct way to change an image's size.
|
|
|
|
|
|
|
|
The exceptions to this are:
|
|
|
|
|
|
|
|
* The ICO and ICNS image formats, which use ``im.size = (100, 100)`` to select a subimage.
|
2023-11-01 21:18:25 +03:00
|
|
|
* The TIFF image format, which now has a :py:exc:`DeprecationWarning` for this action,
|
|
|
|
as direct image size setting was previously necessary to work around an issue with tile extents.
|
2018-09-30 17:12:20 +03:00
|
|
|
|
|
|
|
|
2018-07-09 17:04:48 +03:00
|
|
|
API Additions
|
|
|
|
=============
|
|
|
|
|
2018-09-29 17:19:13 +03:00
|
|
|
Added line width parameter to rectangle and ellipse-based shapes
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-09-29 16:40:11 +03:00
|
|
|
|
2018-09-29 16:52:07 +03:00
|
|
|
An optional line ``width`` parameter has been added to ``ImageDraw.Draw.arc``,
|
2018-09-29 16:40:11 +03:00
|
|
|
``chord``, ``ellipse``, ``pieslice`` and ``rectangle``.
|
|
|
|
|
2018-09-29 16:35:55 +03:00
|
|
|
Curved joints for line sequences
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
``ImageDraw.Draw.line`` draws a line, or lines, between points. Previously,
|
|
|
|
when multiple points are given, for a larger ``width``, the joints between
|
|
|
|
these lines looked unsightly. There is now an additional optional argument,
|
2020-07-10 00:50:57 +03:00
|
|
|
``joint``, defaulting to :data:`None`. When it is set to ``curved``, the joints
|
2018-09-29 16:35:55 +03:00
|
|
|
between the lines will become rounded.
|
|
|
|
|
2018-07-09 17:04:48 +03:00
|
|
|
ImageOps.colorize
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-07-11 23:05:08 +03:00
|
|
|
Previously ``ImageOps.colorize`` only supported two-color mapping with
|
|
|
|
``black`` and ``white`` arguments being mapped to 0 and 255 respectively.
|
|
|
|
Now it supports three-color mapping with the optional ``mid`` parameter, and
|
|
|
|
the positions for all three color arguments can each be optionally specified
|
|
|
|
(``blackpoint``, ``whitepoint`` and ``midpoint``).
|
2018-07-09 17:04:48 +03:00
|
|
|
For example, with all optional arguments::
|
2018-09-30 17:12:20 +03:00
|
|
|
|
2018-09-29 16:35:55 +03:00
|
|
|
ImageOps.colorize(im, black=(32, 37, 79), white='white', mid=(59, 101, 175),
|
2018-07-09 17:04:48 +03:00
|
|
|
blackpoint=15, whitepoint=240, midpoint=100)
|
|
|
|
|
2018-09-29 03:52:43 +03:00
|
|
|
ImageOps.pad
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
While ``ImageOps.fit`` allows users to crop images to a requested aspect ratio
|
|
|
|
and size, new method ``ImageOps.pad`` pads images to fill a requested aspect
|
|
|
|
ratio and size, filling new space with a provided ``color`` and positioning the
|
|
|
|
image within the new area through a ``centering`` argument.
|
2018-07-09 17:04:48 +03:00
|
|
|
|
|
|
|
Other Changes
|
|
|
|
=============
|
|
|
|
|
2018-09-30 08:26:50 +03:00
|
|
|
Added support for reading tiled TIFF images through LibTIFF. Compressed TIFF
|
|
|
|
images are now read through LibTIFF.
|
|
|
|
|
2018-09-29 04:12:49 +03:00
|
|
|
RGB WebP images are now read as RGB mode, rather than RGBX.
|