pillow-heif
Python bindings to libheif for working with HEIF images and plugin for Pillow.
Features:
Decoding of 8, 10, 12 bit HEIC files.
Encoding of 8, 10, 12 bit HEIC files.
EXIF, XMP, IPTC read & write support.
Support of multiple images in one file and a PrimaryImage attribute.
Adding & removing thumbnails.
Reading of Depth Images.
(beta) Reading of Auxiliary Images by johncf
Adding HEIF support to Pillow in one line of code as a plugin.
Note: Here is a light version pi-heif of this project without encoding capabilities.
Example of use as a Pillow plugin
from PIL import Image
from pillow_heif import register_heif_opener
register_heif_opener()
im = Image.open("image.heic") # do whatever need with a Pillow image
im = im.rotate(13)
im.save(f"rotated_image.heic", quality=90)
- bit PNG to 10 bit HEIF using OpenCV
import cv2
import pillow_heif
cv_img = cv2.imread("16bit_with_alpha.png", cv2.IMREAD_UNC
|