13.1.0 (unreleased)¶
Security¶
TODO¶
TODO
CVE YYYY-XXXXX: TODO¶
TODO
Backwards incompatible changes¶
TODO¶
TODO
Deprecations¶
Image.putpixel ‘value’ lists¶
Passing lists to the value parameter of putpixel() has
been deprecated. Use tuples instead.
API changes¶
TODO¶
TODO
API additions¶
ImageDraw dash¶
ImageDraw.line(), ImageDraw.polygon() and
ImageDraw.rectangle() now accept an optional dash argument.
It is a tuple of integers, specifying the lengths of alternating drawn and blank
segments. For example, (10, 5) draws 10 pixels, skips 5, and repeats). If an odd
number of values is given, it continues to alternate (e.g. (1, 2, 3) draws 1 pixel,
skips 2, draws 3, skips 1, draws 2, and so on.
When dash is set, width is ignored.
ImageOps sepia and neon¶
Two new image processing operations are available in ImageOps.
Other changes¶
Empty JPEG APP and COM segments¶
Empty APP and COM segments in JPEG images are no longer added to
JpegImageFile.applist, since they carry no data. This reduces the memory used when
opening images that contain many of them.
Multiple PNG ICC profiles¶
The PNG specification allows at most one iCCP chunk. If an image contains more than one, only the first is now used, and later iCCP chunks are skipped without being decompressed.
Rounding crop coordinates¶
crop() rounds float coordinates to the nearest integer.
Coordinates ending in .5 were rounded to the nearest even integer, so a box of the same
size could give an image one pixel larger or smaller depending on where it was. They
are now always rounded up.
Scaling empty text¶
wrap() now raises ValueError for empty or
whitespace-only text with scaling, before adjusting the font size.
Writing to read-only images¶
frombytes() and
apply(), which in-place ImageCms transforms
use, now copy an image before writing to it if its memory is read-only, as
paste() already does. Previously, they could crash on
memory-mapped image files, or modify the buffer behind an image created by
frombuffer() or fromarrow().
As a further safeguard, the C decoder and ImageCms transform layers now raise a
ValueError if asked to write into a read-only image directly.
Resizing I;16B and I;16N images¶
On little-endian systems, resize() read and wrote
I;16B and I;16N pixel values in the wrong byte order when using a resampling
filter other than Resampling.NEAREST. This has been fixed.
Blurring I;16 images¶
GaussianBlur and BoxBlur
now support I;16, I;16L, I;16B and I;16N images.
Rank filters for I;16 images¶
RankFilter, MedianFilter,
MinFilter and MaxFilter
now support I;16, I;16L, I;16B and I;16N images.
Respect Python build-tree configuration¶
When building against a Python build tree, Pillow now skips the extra library and include directory lookups based on Python’s installation prefix. This avoids adding unprefixed installation paths in cross-compilation environments. Builds against an installed Python retain the existing lookups.
APNG frames with previous disposal¶
In Pillow 13.0.0, loading an APNG frame before seeking to the next could cause
frames using Disposal.OP_PREVIOUS and Blend.OP_OVER to be drawn over the
wrong image. This has been fixed.
Minimum C version¶
C11 is now the minimum version of C required to compile Pillow from source. Pillow requires Python 3.11 or later, and CPython 3.11 and later require C11.
WebP encoding errors now include a description¶
When libwebp fails to encode an image, the raised ValueError now
consistently describes the error rather than only reporting a numeric code.
ImageCms.isIntentSupported intent range¶
isIntentSupported() now returns -1 if intent is not between
0 and 3. Previously, when Pillow was built against Little CMS 2.14 or earlier, an
out-of-range intent could read invalid memory and crash.
zlib-ng in Linux wheels¶
The Linux wheels now link zlib-ng statically. Previously, zlib-ng was built but
not bundled into the wheels, so the system zlib was used at runtime instead, and
PIL.features.version_feature("zlib_ng") reported a version that was not in use.
Pillow 13.0.0 also failed to import on systems where libz.so.1 was not on the
default library search path, such as NixOS. Linux wheels no longer require a
system zlib, and gain the speed of zlib-ng as macOS and Windows wheels already did.
Remapping palettes with too many entries¶
remap_palette() now raises ValueError straight
away if dest_map has more than 256 entries. Such maps already raised
ValueError, but only after processing every entry, which could take a long
time for a very long list.
BMP saving preserves alpha channel¶
RGBA images saved as BMP are now written with a BITMAPV4HEADER, bitfields compression and channel masks, so the alpha channel is preserved when the file is reloaded instead of being silently dropped. Other modes are unchanged.
Kerning in the basic layout engine¶
When libraqm is not available, kerning was applied at 1/64th of its intended size, because a value in pixels was added to an advance in 26.6 fixed point precision. The full kerning value is now applied even when libraqm is not available.
Memory leak when merging a single band with a mismatched mode¶
merge() with a single band whose mode does not match the
requested mode, such as Image.merge("F", [l_image]), raised
ValueError but leaked the memory allocated for the output image. This
has been fixed.
Added support for XML and XMP metadata in JPEG 2000¶
XML and XMP metadata will now be read into info from JPEG
2000 images. When saving, metadata can be specified using the xml or xmp
argument.
ImageEnhance with I;16 images¶
Color, Contrast,
Brightness and Sharpness
now support I;16, I;16L, I;16B and I;16N images.
BLP2 DXT images with a width of 1 or 2¶
BLP2 images using DXT1, DXT3 or DXT5 compression with a width of 1 or 2 pixels were decoded incorrectly, and used up to four times more memory than needed while loading. This has been fixed.
Rectangle outline width¶
ImageDraw.rectangle() draws its outline inwards from the edges of the
rectangle. Previously, if width was more than the size of the rectangle, the
outline could extend outside it, drawing a larger rectangle than requested. The
rectangle is now filled with the outline color instead. Wide outlines are also drawn
faster.