Pillow Plugin — pillow-heif 1.6.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` class.

  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, metadata, primary, bit_depth, thumbnails, depth_images, aux, original_orientation

    Optional there can be also such keys:

      xmp, chroma, icc_profile, icc_profile_type, nclx_profile, content_light_level, mastering_display_colour_volume, ambient_viewing_environment, pixel_aspect_ratio, tiling, heif

  info["original_orientation"]: int

    Orientation that the `EXIF`/`XMP` tags had in the file, or `None` when there was none. The plugin calls `set_orientation()` for every image, so the tags themselves are already reset when the image is opened, see Workarounds.

  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

    Number of available frames.

    Returns:

      Frame number, starting with 0.

  property is_animated: bool

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

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

  Bases: `_LibHeifImageFile`

  Pillow plugin class type for a HEIF 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.