Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
Pillow (PIL Fork) 12.0.0 documentation
Light LogoDark Logo
Pillow (PIL Fork) 12.0.0 documentation
Back to top

11.2.1 (2025-04-12)

Warning

The release of Pillow11.2.0 was halted prematurely, due to hitting PyPI’sproject size limit and concern over the size of Pillow wheels containing libavif.The PyPI limit has now been increased and Pillow11.2.1 has been releasedinstead, without libavif included in the wheels.To avoid confusion, the incomplete 11.2.0 release has been removed from PyPI.

Security

Undefined shift when loading compressed DDS images

When loading some compressed DDS formats, an integer was bitshifted by 24 places togenerate the 32 bits of the lookup table. This was undefined behaviour, and has beenpresent since Pillow 3.4.0.

Deprecations

Image.Image.get_child_images()

Deprecated since version 11.2.1.

Image.Image.get_child_images() has been deprecated. and will be removed in Pillow13 (2026-10-15). It will be moved toImageFile.ImageFile.get_child_images(). Themethod uses an image’s file pointer, and so child images could only be retrieved fromanPIL.ImageFile.ImageFile instance.

API changes

append_images no longer requiressave_all

Previously,save_all was required to in order to useappend_images. Now,save_all will default toTrue ifappend_images is not empty and the formatsupports saving multiple frames:

im.save("out.gif",append_images=ims)

API additions

"justify" multiline text alignment

In addition to"left","center" and"right", multiline text can also bealigned using"justify" inImageDraw:

fromPILimportImage,ImageDrawim=Image.new("RGB",(50,25))draw=ImageDraw.Draw(im)draw.multiline_text((0,0),"Multiline\ntext 1",align="justify")draw.multiline_textbbox((0,0),"Multiline\ntext 2",align="justify")

Specify window in ImageGrab on Windows

When usinggrab(), a specific window can be selected using theHWND:

fromPILimportImageGrabImageGrab.grab(window=hwnd)

Check for MozJPEG

You can check if Pillow has been built against the MozJPEG version of thelibjpeg library, and what version of MozJPEG is being used:

fromPILimportfeaturesfeatures.check_feature("mozjpeg")# True or Falsefeatures.version_feature("mozjpeg")# "4.1.1" for example, or None

Saving compressed DDS images

Compressed DDS images can now be saved using apixel_format argument. DXT1, DXT3,DXT5, BC2, BC3 and BC5 are supported:

im.save("out.dds",pixel_format="DXT1")

Other changes

Arrow support

Arrow is an in-memory data exchange format that is thespiritual successor to the NumPy array interface. It provides for zero-copy access tocolumnar data, which in our case isImage data.

To create an image with zero-copy shared memory from an object exporting thearrow_c_array interface protocol:

fromPILimportImageimportpyarrowaspaarr=pa.array([0]*(5*5*4),type=pa.uint8())im=Image.fromarrow(arr,'RGBA',(5,5))

Pillow images can also be converted to Arrow objects:

fromPILimportImageimportpyarrowaspaim=Image.open('hopper.jpg')arr=pa.array(im)

Reading and writing AVIF images

Pillow can now read and write AVIF images when built from source with libavif 1.0.0or later.

On this page

[8]ページ先頭

©2009-2025 Movatter.jp