Skip to content

Pillow Extensions API

Functions for registering the Pillow plugin and converting directly between PIL.Image and pylibheif native buffers.


Plugin Management

pylibheif.register_pillow_opener

register_pillow_opener() -> None

Register pylibheif as a HEIF/AVIF image opener in Pillow.

pylibheif.unregister_pillow_opener

unregister_pillow_opener() -> None

Unregister pylibheif handler from Pillow.


Direct Conversions

pylibheif.to_pillow

to_pillow(source: Any, convert_hdr_to_8bit: bool = True, options: Optional[HeifDecodingOptions] = None, num_threads: Optional[int] = None) -> Any

Convert a HeifImage or HeifImageHandle into a Pillow Image.

pylibheif.from_pillow

from_pillow(pil_image: Any, bit_depth: int = 8) -> Any

Convert a Pillow Image into a pylibheif HeifImage.