Pillow Plugin — pillow-heif 0.22.0 documentation

# Pillow Plugin

## HeifImageFile object

Plugin supports decoding and encoding multiply image frames.
How to register it see: Registering plugin
It supports all functionality, that supported by other Pillow’s image plugins.

class pillow_heif.as_plugin._LibHeifImageFile(*args, **kwargs)

  Bases: `ImageFile`

  Base class with all functionality for `HeifImageFile` and `AvifImageFile` classes.

  info: dict

    A dictionary holding data associated with the image.

    Note

    Known to this plugin keys and values in dictionary will be saved to the image. They are the same as in `HeifImage` class.

    Specific keys for this plugin that is always present are:

      exif, xmp, metadata, primary, bit_depth, thumbnails

    Optional there can be also such keys:

      icc_profile, icc_profile_type, nclx_profile

  get_format_mimetype()

    Returns the same as `get_file_mimetype()`

  load()

    Load image data based on tile list

  seek(frame: int)

    Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises an `EOFError` exception. When a sequence file is opened, the library automatically seeks to frame 0.

    See `tell()`.

    If defined, `n_frames` refers to the number of available frames.

    Parameters:

      frame – Frame number, starting at 0.

    Raises:

      EOFError – If the call attempts to seek beyond the end of the sequence.

  tell() → int

    Returns the current frame number. See `seek()`.

    If defined, `n_frames` refers to the number of available frames.

    Returns:

      Frame number, starting with 0.

  verify() → None

    Check file integrity

  property n_frames: int

    Returns the number of available frames.

    Returns:

      Frame number, starting with 0.

  property is_animated: bool

    Returns `True` if this image contains more than one frame, or `False` otherwise.

class pillow_heif.HeifImageFile(*args, **kwargs)

  Bases: `_LibHeifImageFile`

  Pillow plugin class type for a HEIF image format.

class pillow_heif.AvifImageFile(*args, **kwargs)

  Bases: `_LibHeifImageFile`

  Pillow plugin class type for an AVIF image format.

pillow_heif.register_heif_opener(**kwargs) → None

  Registers a Pillow plugin for HEIF format.

  Parameters:

    kwargs – dictionary with values to set in options. See: Options.

pillow_heif.register_avif_opener(**kwargs) → None

  Registers a Pillow plugin for AVIF format.

  Parameters:

    kwargs – dictionary with values to set in options. See: Options.