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

10.1.0 (2023-10-15)

API changes

Setting image mode

If you attempt to set the mode of an image directly, e.g.im.mode="RGBA", you will now receive anAttributeError. This isnot about removing existing functionality, but instead about raising anexplicit error to prevent later consequences. Theconvert method is thecorrect way to change an image’s mode.

Accept a list in getpixel()

getpixel() now accepts a list of coordinates, as wellas a tuple.

fromPILimportImageim=Image.new("RGB",(1,1))im.getpixel((0,0))im.getpixel([0,0])

BoxBlur and GaussianBlur allow for different x and y radii

BoxBlur andGaussianBlur now allow a sequence of x and y radiito be specified, rather than a single number for both dimensions.

fromPILimportImageFilterImageFilter.BoxBlur((2,5))ImageFilter.GaussianBlur((2,5))

API additions

EpsImagePlugin.gs_binary

EpsImagePlugin.gs_windows_binary stores the name of the Ghostscriptexecutable on Windows.EpsImagePlugin.gs_binary has now been added for allplatforms, and can be used to customise the name of the executable, or disableuse entirely throughEpsImagePlugin.gs_binary=False.

has_transparency_data

Images now havehas_transparency_data to indicatewhether the image has transparency data, whether in the form of an alphachannel, a palette with an alpha channel, or a “transparency” key in theinfo dictionary.

Even if this attribute is true, the image might still appear solid, if all ofthe values shown within are opaque.

ImageOps.cover

Returns a resized version of the image, so that the requested size is covered,while maintaining the original aspect ratio.

SeeResize relative to a given size for a comparison between this and similarImageOpsmethods.

size and font_size arguments when using default font

Pillow has had a “better than nothing” default font, which can only be drawn atone font size. Now, if FreeType support is available, a version ofAileron Regular is loaded, which can bedrawn at chosen font sizes.

The followingsize andfont_size arguments can now be used to specify afont size for this new builtin font:

ImageFont.load_default(size=24)draw.text((0,0),"test",font_size=24)draw.textlength((0,0),"test",font_size=24)draw.textbbox((0,0),"test",font_size=24)draw.multiline_text((0,0),"test",font_size=24)draw.multiline_textbbox((0,0),"test",font_size=24)

Other changes

Python 3.12

Pillow 10.0.0 had wheels built against Python 3.12 beta, available as a preview to helpothers prepare for 3.12, and to ensure Pillow could be used immediately at the releaseof 3.12.0 final (2023-10-02,PEP 693).

Pillow 10.1.0 now officially supports Python 3.12.

Added support for DDS BC5U and 8-bit color indexed images

Support has been added to read BC5U DDS files as RGB images, andPALETTEINDEXED8 DDS files as P mode images.

Support reading signed 8-bit YCbCr TIFF images

TIFF images with unsigned integer data, 8 bits per sample and a photometricinterpretation of YCbCr can now be read.

On this page

[8]ページ先頭

©2009-2025 Movatter.jp