pypi / pillow
pillow
What changed in pillow 12 to 13, from its official release notes, upgrade guides and advisories. Also covers types-pillow. Sources checked 2026-11-30.
63 breaking76 security10 deprecations13 new APIs and options22 performance20 behavior and defaults73 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpillow 13157 changes
Breaking changes 35
Saving P mode frames with different palettes now converts to RGB or RGBA rather than writing later frames with incorrect colors.
Duration and timestamp are removed from AVIF info after seek.
Invalid and non-finite radii are rejected.
The Makernote IFD constant is removed.
FITS data is treated as big-endian.
The undocumented GIF saving helper is removed.
All wheels link against Pillow's bundled HarfBuzz, which may slightly change text rendering in scripts that rely on the auto-hinter.
Converting I;16N images to I or F now preserves the full 16-bit range instead of clipping values to 255.
When an ICO image is smaller than 16×16, saving preserves its original size by default.
When saving a frame without a matching size, the next smallest provided image is used.
Image._show has been removed; use show() instead.
The mode parameter no longer supports changing data types; other uses, such as placing grayscale data in P mode, remain available.
Exporting Arrow arrays from non-contiguous images is rejected.
Calling quantize() with an empty palette now raises an error.
When height is scaled down significantly more than width, resizing now proceeds vertically first.
RGBA and LA resizing now uses reducing_gap.
The product_info attribute has been removed; it had been set to None since Pillow 2.3.0.
The product_name attribute has been removed; it had been set to None since Pillow 2.3.0.
For RGBa and La modes, getcolor() now returns alpha-premultiplied values to match how pixels are stored.
Pen widths are used when drawing shape outlines.
The method has moved from Image.Image to ImageFile.ImageFile, because retrieving child images requires an image file pointer.
Invalid arguments now raise ValueError instead of triggering an assertion.
Values of bits outside 1–8 now raise ValueError.
Creating an ImagePalette with an unsupported mode now raises an error.
Text is wrapped even when no scaling is required.
JPEG streams with scanlines that are too wide or have too many components are rejected.
The default max_nesting limit is set to 900.
Saving P mode images with the bits argument no longer pads the PLTE chunk; it contains only the entries in the image palette.
Support for Python 3.10 is dropped; developers must use a supported Python version.
Saving I mode images as PNG no longer clips values to fit the format; convert to another mode before saving.
TIFFs whose unpacker row is wider than libtiff's decoded row are rejected.
The first of duplicate TIFF tags is retained.
Duration and timestamp are removed from WebP info after seek.
WMF dimensions are limited to 0–65535 when loading.
XMP info is no longer a tuple.
Security 55
A decompression bomb bypass involving delayed disposal-frame sizing has been fixed.
Decompression bomb checks are added when seek opens a new format and after SPIDER seek.
Filename argument injection into Ghostscript and a decompression bomb bypass through Ghostscript rendering have been fixed.
Ghostscript is prevented from rendering beyond the decompression bomb limit.
Quadratic-time blowup from repeated concatenation has been fixed.
A buffer overflow when merging 32-bit images as narrower bands has been fixed.
A double-free vulnerability after an allocation failure has been fixed.
A decompression bomb check is added for Windows clipboard images.
A decoder buffer overflow involving scanlines wider than tile extents has been fixed.
PDF page trees are walked iteratively, and page loops raise an error.
Stack exhaustion from cyclic page-tree references has been fixed.
PDF object IDs are assigned in constant time.
An integer underflow in text width calculation has been fixed.
Pillow: APNG background disposal allocates full canvas before decompression bomb check
Pillow: Argument Injection in Ghostscript call, potentially leading into RCE
Pillow: Arrow export leaks stale heap memory when PILLOW_ALIGNMENT > 1
Pillow: BMP RLE decoder memory-amplification DoS via unbounded delta escape / absolute mode
Pillow: Bundled libopenjp2 2.5.4 in all wheels since 11.1.0 carries OSV-2025-219 heap-buffer-overflow write reachable from Image.open().load()
Pillow: Decompression-bomb protection bypass via multi-frame seek() in MPO and DCX (MpoImageFile.seek / DcxImageFile.seek)
Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform
Pillow: EPS load(scale) lets Ghostscript render past the decompression bomb limit
Pillow: GIF seek keeps rejected size after DecompressionBombError, allowing DoS
Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution
Pillow: Heap buffer overflow in ImagingJpegDecode
Pillow: Heap buffer overflow saving TIFF with libtiff when tags override image size
Pillow: Heap buffer overflow writing JPEG comment after ICC profile fills buffer
Pillow: Heap use-after-free when encoding TIFF to an in-memory buffer
Pillow: Image.quantize() with empty palette leaks uninitialized stack memory
Pillow: Infinite loop in MIC n_frames when the embedded TIFF
Pillow: Invalid free in FreeType glyph rendering when a stroker is active
Pillow: Memory disclosure and segfault in libtiff encoder via crafted TIFF tags
Pillow: Memory DoS in TIFF and EXIF IFD parsing via overlapping tag data
Pillow: MSP RLE decoder expands a tiny file into unbounded memory
Pillow multi-frame loaders can reuse stale native image storage after mode transitions
Pillow: NULL dereference in ImagingExpand via rank filters on zero-size images
Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0
Pillow: Out-of-bounds access in _imagingmorph on a zero-width image
Pillow: P;2L and P;4L decoders may read 1 to 3 bytes past the passed buffer size
Pillow PDF append accepts malformed shared page-tree DAG causing resource exhaustion
Pillow: PNG eXIf chunk makes EXIF parsing run in quadratic time
Pillow: Quadratic GIF comment concatenation allows DoS in Image.open()
Pillow: Quadratic GIF comment copying during save
Pillow: Reachable undefined behavior in native integer operations, potentially leading to denial of service or logic integrity compromise
Pillow: ReDoS in XbmImagePlugin: 512-byte file stalls Image.open() for minutes
Pillow: TarIO negative size field causes infinite CPU-spin loop
Pillow: TIFF encoder ColorMap plane-size mismatch causes a heap out-of-bounds read
Pillow: TiffDecode returns uninitialized memory as pixels for short JPEG strips
Pillow tiled-TIFF decoder reads past tile buffer in copy4 (Unpack.c:1290)
Pillow: Unbounded recursion parsing a PDF page tree or trailer chain (incomplete fix for CVE-2026-42310)
A decompression bomb bypass via seek() has been fixed.
Out-of-bounds reads from undersized libtiff buffers and uninitialized memory from short JPEG strips have been fixed.
Multiple TIFF encoder vulnerabilities involving invalid colormaps, buffer overflows, mismatched tags, and use-after-free writes have been fixed.
TIFF strip and tile buffers are cleared beyond previously decoded data.
Retained TIFF tag data is bounded by the stream size.
A heap buffer overflow when saving TIFF to BytesIO is fixed.
Deprecations 4
The IM image format is deprecated.
ImageQt.align8to32() is deprecated in favour of the raw encoder stride.
ImageQt.align8to32() is deprecated and has no replacement.
JpegImageFile.load_djpeg is deprecated.
New APIs and options 5
Image.getxmp() gains a strip_namespaces argument.
A new Magic Kernel Sharp resizing filter is available for resize() and thumbnail().
Magic Kernel Sharp resizing modes are now supported.
load(), load_path() and save() now accept os.PathLike objects, such as pathlib.Path, as well as strings.
PSDraw.text gains an escape argument.
Performance 7
Image.filter() is faster for I;16* modes.
getpixel() and get_flattened_data() are faster.
Image.offset is faster.
Flipping and rotating by 180 degrees with transpose() is up to 10 times faster.
ImageChops.difference() is faster.
Bundled libraries are compiled with -O2, improving JPEG 2000, LZW TIFF, ImageFont rendering, and ImageCms transforms; PNG, JPEG, WebP, and AVIF are unaffected.
Importing Pillow takes around half the time; some modules are imported on first use, and Python 3.15 defers remaining standard-library imports.
Behavior and default changes 12
Explicit BASIC layout is respected in font_variant().
ImageMath operations now accept floating point constants.
ImageOps invert, posterize, and solarize now support P images.
invert() now supports P mode images by operating on palette colors while leaving palette alpha values unchanged.
posterize() now supports P mode images by operating on palette colors while leaving palette alpha values unchanged.
solarize() now supports P mode images by operating on palette colors while leaving palette alpha values unchanged.
ImageOps can now create images with zero dimensions.
Font handling now supports pathlib paths.
Pillow adds support for Python 3.15.
Zero-length members in tar files are supported.
Greyscale TIFFs with ExtraSamples 0 or 1 are supported.
XBM headers now allow C comments.
Fixes and other changes 39
Decoding an AVIF image no longer blocks all threads.
Truncated or corrupt gzip FITS data now raises OSError.
16-bit and 32-bit integer and 32-bit and 64-bit floating-point FITS images now load with correct pixel values.
Invalid radii are rejected.
Saving identical consecutive frames no longer raises KeyError when an earlier frame lacks a duration and a later frame has one.
Kernel filtering now preserves values above 255 in I;16 images.
Converting from I;16N to I or F no longer clips 16-bit values.
Zero-dimension images can be passed to fromarrow().
Image.getbbox() is faster and is fixed for I;16 modes.
Masked histograms for LA, La, and PA images now derive the second band from the alpha band.
Zero-dimension images are supported by related image filters and offset operations.
An empty target palette no longer causes a crash in Image.quantize().
tobytes() now explicitly cleans up its encoder on success and failure.
ImageChops.offset is fixed for 16-bit modes and is faster.
offset() now works correctly for 16-bit-per-channel images.
ImageColor.getcolor() now handles premultiplied alpha modes.
Drawing operations on I;16B images now use the byte order of the image mode.
The border type hint is corrected.
expand() now preserves the source image's transparency value when adding a border.
The background color is corrected when padding P mode images.
pad() now preserves the source image's transparency value when adding a border.
Transparency is preserved when padding and expanding images.
compact() returns zero when there are no points to remove.
The image position is restored after an error.
ImageStat variance is prevented from becoming negative.
Opening a JP2 image with an unrecognized mode now raises an error.
Unexpected end-of-file in a JPEG header is handled.
Support for PyPy 3.12 is added.
Truncated tRNS, gAMA, and cHRM chunks now raise ValueError.
The bits option is applied when saving L mode PNG images, without padding the palette when bits is specified.
PSD layer tiles are read from the correct file offset.
TIFF saving now cleans up the libtiff encoder, including on exceptions, preventing delayed destruction from disturbing a reused file descriptor.
TIFF tag values are validated against libtiff's field definitions before being passed to TIFFSetField.
TIFF ColorMap length is corrected when saving with libtiff.
TIFF seek no longer changes MicImageFile frame count or animation state.
TIFF scanline geometry tags are taken from the image rather than tiffinfo or EXIF.
TIFFs with unexpected tile sizes now raise OSError.
TIFF ColorMap length is checked against BitsPerSample.
The WebP canvas size is checked before creating a decoder.
pillow 12120 changes
Breaking changes 28
FontFile classes now perform decompression bomb checks.
ImageMath.unsafe_eval() no longer sets eval() globals.
macOS retina screenshots are no longer resized by default.
1 mode images are no longer saved as TGA with run-length encoding.
Raises ValueError if the tag value is not bytes.
Rejects non-numeric elements in list coordinates.
Always calls StubHandler open() when opening a StubImageFile.
Resizes tall images vertically first.
The experimental BGR;15, BGR;16 and BGR;24 image modes were removed.
Deleting an EXIF IFD tag now also deletes its IFD data.
FreeType versions 2.9.0 and earlier are no longer supported.
The hints parameter in getdraw() was removed.
Quantizing RGB images now fills the alpha channel.
Non-image modes are no longer supported by ImageCms.
This ImageCms constant was removed and has no replacement.
The LittleCMS version 1 flags table was removed and replaced with the ImageCms.Flags class based on LittleCMS 2 flags.
This constant was removed; use PIL.__version__ instead.
The function was removed; use PIL.features.version_module() with feature="littlecms2", sys.version or sys.version_info, and PIL.__version__.
The undocumented function was removed; ImageFile already translates error codes returned by a codec’s decode() method automatically.
ImageMath.eval() was removed; use lambda_eval() or unsafe_eval() instead.
ImageMorph operations must have length 1.
This undocumented helper function intended for internal use was removed, with no replacement.
This undocumented constant intended for internal use was removed, with no replacement.
Support for LibTIFF versions earlier than 4 was removed; upgrade to a newer version.
Negative offsets are no longer allowed with memory mapping.
Support for PyPy3.10 was dropped.
Support for Python 3.9 was dropped, so applications need a supported Python version to use this release.
Converting RGBA to PA now uses RGB-to-P quantization.
Security 21
A decompression bomb check is now applied to GdImageFile.
Pillow
BdfFontFile:Image.new()called without_decompression_bomb_check()— bomb protection bypass via font loadingPillow: Controlled heap out-of-bounds write in Pillow
ImageCmsTransform.apply()via output mode mismatchPillow: Decompression Bomb DoS via PdfParser.PdfStream.decode()
Pillow EpsImagePlugin negative %%BeginBinary byte count causes infinite loop denial of service
Pillow:
FontFile.compile():Image.new()called without_decompression_bomb_check()Pillow
GdImageFile._open(): image dimensions accepted without_decompression_bomb_check()Pillow: Heap out-of-bounds write
Image.paste()/Image.crop()via signed coordinate overflowPillow: Heap out-of-bounds write in
ImageFilter.RankFiltervia integer overflow inImagingExpandPillow JPEG2000 tiled decode retains a growing scratch buffer and can be used for denial of service
Pillow: Out-of-bounds read via attacker-controlled row stride on Pillow's mmap path (McIdas AREA files)
Pillow
PcfFontFile._load_bitmaps():Image.frombytes()called without_decompression_bomb_check()— bomb protection bypass via PCF font loadingPillow TGA RLE encoder can serialize up to ~57 KB of adjacent heap data into generated images
Pillow: WindowsViewer.get_command() OS command injection via unescaped shell path
FITS GZIP decompression bomb in Pillow
Pillow has a heap buffer overflow with nested list coordinates
Pillow has a PDF Parsing Trailer Infinite Loop (DoS)
Pillow has an integer overflow when processing fonts
Pillow has an OOB Write with Invalid PSD Tile Extents (Integer Overflow)
Pillow affected by out-of-bounds write when loading PSD images
The length of read operations is now limited when loading PIL font data.
Deprecations 6
A new method is available as the preferred alternative to getdata().
getdata() is deprecated in favour of get_flattened_data().
Image._show is deprecated; developers using this API should plan to stop relying on it.
The mode parameter is deprecated only when it changes the data type.
The product_info attribute is deprecated.
The product_name attribute is deprecated.
New APIs and options 8
An abstract BaseImageFont class is added.
ImageFont can also be used with ImageText.
Adds FontFile.to_imagefont().
Adds the Exif tag FrameRate.
Adds text wrapping through ImageText.Text.wrap().
Font variation styles can now be duplicated.
On macOS, ImageGrab.grab() can now receive a window ID.
A simpler API for using fonts with text strings or bytes was added, with methods for color embedding, strokes, length, and bounding boxes.
Performance 15
alpha_composite is faster.
Image.blend() is faster.
Image.fill() is faster.
Image.filter() is faster.
Image.getchannel() is faster.
Image.linear_gradient() is faster.
Image.merge() is faster.
Image.putalpha() is faster.
Image.radial_gradient() is faster.
Image.resample() is faster.
Image.split() is faster.
ImageChops operations are faster.
matrix is faster.
negative is faster.
quantize is faster.
Behavior and default changes 8
Opening and saving L mode AVIF images is supported with libavif 1.3.0 or newer.
Adds support for reading JPEG2000 images with CMYK palettes.
Saving APNG images now supports float durations.
build_default_lut() now returns the LUT.
MorphOp now allows 1 mode images.
Writing IFD, SIGNED_RATIONAL, and InkNames TIFF tags is now supported.
alpha_composite now supports LA images.
Saving variable length rational TIFF tags is supported by default.
Fixes and other changes 34
The XOR mask is now applied to 1 and L mode CUR images.
Raises ValueError if the tile size is not 64px by 64px.
Raises ValueError when P;2L or P;4L data is truncated.
Raises ValueError if the border format is unsupported.
Raises OverflowError if the number of vertices is too large.
Parsing PSD layers no longer raises an error for an unknown channel ID.
The type hint for xy now allows lists.
Size and rank are validated when initializing RankFilter, and large filter sizes are validated.
Corrects the error check when encoding AVIF images.
Corrects BMP pixel data offsets when palette entries have different sizes.
Fixes BMP RLE delta escape reading from the wrong file position.
Encoding an empty image raises ValueError.
Raises an error if the ImageGrab subprocess returns a non-zero return code.
Closes the file handle only when ImagePalette.save() opened it internally.
Does not use palettes from grayscale or bilevel colorspaces when reading JPEG2000 images.
Raises EOFError when seeking too far in PSD data.
Fills the alpha channel when a TGA v2 extension area specifies no alpha.
Ignores unspecified extra samples for TIFF separate planar configuration.
Raises an error when a trailer chain loops back on itself.
Fixes an unexpected error when saving images with zero dimensions.
Fixed an out-of-bounds write when tile extents are invalid.
Patched libavif for compatibility with svt-av1 4.0, which matters when building Pillow with that version.
A ZeroDivisionError in DdsImagePlugin is fixed.
All non-zero transparency values are now read as 255.
Encoder options are now applied when saving multiple PNG frames.
Parsing EPS metadata now seeks past BeginBinary data.
Part of the deprecated mode parameter functionality was restored, allowing grayscale L data in a P image or RGB data read as YCbCr.
Pasting an image onto itself at a lower position now copies from the bottom.
RGBA palettes are now supported when expanding images.
A ZeroDivisionError in ImageStat was fixed.
Reading RGB and CMYK IPTC images was fixed.
Python 3.14 is supported.
Loading rotated PCD images was fixed, including setting the correct size after opening.
Two-band histograms now use the correct bands.