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

features module

ThePIL.features module can be used to detect which Pillow features are available on your system.

PIL.features.pilinfo(out:IO[str]|None=None,supported_formats:bool=True)None[source]

Prints information about this installation of Pillow.This function can be called withpython3-mPIL.It can also be called withpython3-mPIL.report orpython3-mPIL--reportto have “supported_formats” set toFalse, omitting the list of all supportedimage file formats.

Parameters:
  • out – The output stream to print to. Defaults tosys.stdout ifNone.

  • supported_formats – IfTrue, a list of all supported image file formats will be printed.

PIL.features.check(feature:str)bool|None[source]
Parameters:

feature – A module, codec, or feature name.

Returns:

True if the module, codec, or feature is available,False orNone otherwise.

PIL.features.version(feature:str)str|None[source]
Parameters:

feature – The module, codec, or feature to check for.

Returns:

The version number as a string, orNone if unknown or not available.

PIL.features.get_supported()list[str][source]
Returns:

A list of all supported modules, features, and codecs.

Modules

Support for the following modules can be checked:

  • pil: The Pillow core module, required for all functionality.

  • tkinter: Tkinter support.

  • freetype2: FreeType font support viaPIL.ImageFont.truetype().

  • littlecms2: LittleCMS 2 support viaPIL.ImageCms.

  • webp: WebP image support.

  • avif: AVIF image support.

PIL.features.check_module(feature:str)bool[source]

Checks if a module is available.

Parameters:

feature – The module to check for.

Returns:

True if available,False otherwise.

Raises:

ValueError – If the module is not defined in this version of Pillow.

PIL.features.version_module(feature:str)str|None[source]
Parameters:

feature – The module to check for.

Returns:

The loaded version number as a string, orNone if unknown or not available.

Raises:

ValueError – If the module is not defined in this version of Pillow.

PIL.features.get_supported_modules()list[str][source]
Returns:

A list of all supported modules.

Codecs

Support for these is only checked during Pillow compilation.If the required library was uninstalled from the system, thepil core module may fail to load instead.Except forjpg, the version number is checked at run-time.

Support for the following codecs can be checked:

  • jpg: (compile time) Libjpeg support, required for JPEG based image formats. Only compile time version number is available.

  • jpg_2000: (compile time) OpenJPEG support, required for JPEG 2000 image formats.

  • zlib: (compile time) Zlib support, required for zlib compressed formats, such as PNG.

  • libtiff: (compile time) LibTIFF support, required for TIFF based image formats.

PIL.features.check_codec(feature:str)bool[source]

Checks if a codec is available.

Parameters:

feature – The codec to check for.

Returns:

True if available,False otherwise.

Raises:

ValueError – If the codec is not defined in this version of Pillow.

PIL.features.version_codec(feature:str)str|None[source]
Parameters:

feature – The codec to check for.

Returns:

The version number as a string, orNone if not available.Checked at compile time forjpg, run-time otherwise.

Raises:

ValueError – If the codec is not defined in this version of Pillow.

PIL.features.get_supported_codecs()list[str][source]
Returns:

A list of all supported codecs.

Features

Some of these are only checked during Pillow compilation.If the required library was uninstalled from the system, the relevant module may fail to load instead.Feature version numbers are available only where stated.

Support for the following features can be checked:

  • libjpeg_turbo: (compile time) Whether Pillow was compiled against the libjpeg-turbo version of libjpeg. Compile-time version number is available.

  • mozjpeg: (compile time) Whether Pillow was compiled against the MozJPEG version of libjpeg. Compile-time version number is available.

  • zlib_ng: (compile time) Whether Pillow was compiled against the zlib-ng version of zlib. Compile-time version number is available.

  • raqm: Raqm library, required forImageFont.Layout.RAQM inPIL.ImageFont.truetype(). Run-time version number is available for Raqm 0.7.0 or newer.

  • libimagequant: (compile time) ImageQuant quantization support inPIL.Image.Image.quantize(). Run-time version number is available.

  • xcb: (compile time) Support for X11 inPIL.ImageGrab.grab() via the XCB library.

PIL.features.check_feature(feature:str)bool|None[source]

Checks if a feature is available.

Parameters:

feature – The feature to check for.

Returns:

True if available,False if unavailable,None if unknown.

Raises:

ValueError – If the feature is not defined in this version of Pillow.

PIL.features.version_feature(feature:str)str|None[source]
Parameters:

feature – The feature to check for.

Returns:

The version number as a string, orNone if not available.

Raises:

ValueError – If the feature is not defined in this version of Pillow.

PIL.features.get_supported_features()list[str][source]
Returns:

A list of all supported features.

On this page

[8]ページ先頭

©2009-2025 Movatter.jp