Python 3.7+ interface to libheif library
Project description
pillow_heif
A HEIF/HEIC add-on for Pillow using the libheif
library via CFFI
.
Binary wheels for Python 3.7-3.10. Linux(+Alpine)/macOS - x64/aarch64(+M1).
Version 0.1.4 was last to support Python 3.6 and still can be used.
Mostly based on David Poirier's pyheif. The idea for this plugin came from Christian Bianciotto's pyheif-pillow-opener. Many thanks!
Pull requests are greatly welcome.
Installation
(Recommended) You can install pillow_heif from PyPi:
pip install pillow_heif
or from GitHub:
pip install https://github.com/bigcat88/pillow_heif/archive/master.zip
Installation from source
Linux Ubuntu
sudo add-apt-repository ppa:strukturag/libheif
apt install libffi libheif-dev libde265-dev
pip install git+https://github.com/bigcat88/pillow_heif.git
MacOS
brew install libffi libheif
pip3 install git+https://github.com/bigcat88/pillow_heif.git
If on macOS it fails with installing from source, just try second time(helps me on M1 with Monterey):
pip3 install git+https://github.com/bigcat88/pillow_heif.git
Windows
With Visual Studio 2015+ C Compiler and SDK installed:
set INCLUDE=%INCLUDE%;X:\path\to\libheif\source
set LIB=%LIB%;X:\path\to\libheif\build
pip install git+https://github.com/bigcat88/pillow_heif.git
Example of use as opener
from PIL import Image
from pillow_heif import register_heif_opener
register_heif_opener()
image = Image.open('image.heic')
image.load()
Example of use as reader
from PIL import Image
import pillow_heif
heif_file = pillow_heif.read('ABC.HEIC')
image = Image.frombytes(
heif_file.mode,
heif_file.size,
heif_file.data,
'raw',
heif_file.mode,
heif_file.stride,
)
The HeifFile object
The returned HeifFile
has the following properties:
size
- the size of the image as a(width, height)
tuple of integersbrand
- a list of heif_brand constantshas_alpha
- (bool)presence of alpha channelmode
- the image mode, e.g. 'RGB' or 'RGBA'bit_depth
- the number of bits in each component of a pixelmetadata
- a list of metadata dictionariescolor_profile
- a color profile dictionarydata
- the raw decoded file data, as bytesstride
- the number of bytes in a row of decoded file data
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pillow_heif-0.1.5-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff8697ec3bbad11ade99c80db57c8536c1742d7dfa7bd2f8b7acf86099c6cda3 |
|
MD5 | 794ee842dcd033416ab578a92cd3f75b |
|
BLAKE2b-256 | c8a418cb2efd33f0ceb7e7541a4e9ac7649481526e656e19d34d3db6ae06f5b7 |
Hashes for pillow_heif-0.1.5-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2830710990b2fe10303a803464ba80e88023b236ec5d2e8c1e5df439ad519bc |
|
MD5 | 4b6614e17363986919581b440d682882 |
|
BLAKE2b-256 | 4af7128ca1d566fb801ff568230b14296092f69bdab46cf9877947493f48e1a0 |
Hashes for pillow_heif-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75fb8da4521c9175916297bd6334993d84c2a7d3f9d004c391ba4a95d8c39f13 |
|
MD5 | 6684f44a0bb744c3d5585e4253c8c028 |
|
BLAKE2b-256 | 13c1bbc6f07fb986b824f92553ede7fa42e24e884973b8917db49ace911a95b4 |
Hashes for pillow_heif-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4350bdc09cdb4897d72e9e8d5568744cac1c5bb8430705535979a759596a9fc4 |
|
MD5 | 76f1c468e7b24646e7ddb0fb80e63d1f |
|
BLAKE2b-256 | da6df1f92f462587e329b1e6878a6c55f2d1937098de4a9b02d2c66df5b1e50f |
Hashes for pillow_heif-0.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cb4c49fcb74e61672d11042210a68bac119eb5c58a875d79f98272c82c2d341 |
|
MD5 | 1b2c33edf0c17e8188ce326a8e1fdf8c |
|
BLAKE2b-256 | cf691d73bbad2837244b542d8f377a440e025bfe08c42d8fca5a19bb82e414c3 |
Hashes for pillow_heif-0.1.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5731616cca9f2c84033c6f4af658ac42f71e04d10711f672c6a0e2a98361be91 |
|
MD5 | bcb953a460876005921ae5ca1001d442 |
|
BLAKE2b-256 | fe5bc664cc4e9b0547e79a46aecf2374972b94530dbb3a82920e833b263f8b17 |
Hashes for pillow_heif-0.1.5-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45cdb6706d6327767fa2dbc37d5ea3383784901ff2a2e78c1222f1e0765c7da6 |
|
MD5 | 83b05431a7956a89e4d907ec6ee65e35 |
|
BLAKE2b-256 | ad3873fe8b503e7624ab7aa50fbeca9239a75bba80176934593148d4554c4b34 |
Hashes for pillow_heif-0.1.5-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96c283bc7626c507c7f57ee45aebb1da9f2f59d0579c569bd8389ce3feec94c2 |
|
MD5 | 97327176fa3b54707ab726a1c9f52efc |
|
BLAKE2b-256 | 2af6e3d91f94fa1dd2f53e796b5a5b8518c9b8455df5b7696c23e4bbfeaaa3b7 |
Hashes for pillow_heif-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ce76f7cdfa96a57b5ca9403da91ac2dcf43bc61f04e81412a2d7e17abf8e023 |
|
MD5 | 00754e506167b77543b8b5da8cc70b6e |
|
BLAKE2b-256 | 704bdcd95087c3e713b11b511307da280e6a514467d3a1728442849c586bd0c6 |
Hashes for pillow_heif-0.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8d25270f71f06549e7adf848873eae7cf72bcc1e8aaf4b9c483e630796e4385 |
|
MD5 | acbd968051a26109c8b997ddcbecc413 |
|
BLAKE2b-256 | 0274180b8d0ec6705ccebed7ba2bbaeea5bdf039fd1e988c92584fc9f08a30fe |
Hashes for pillow_heif-0.1.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe7cdf55f59cd8627fa84bdc81b6d8b958c621a4296639001dcff0f5d065938d |
|
MD5 | 8adf62660a37f17eb518390c2308765d |
|
BLAKE2b-256 | 0bece42e5922819e08315f06e070e3135fb4baab821cce5c8b53e96c66168202 |
Hashes for pillow_heif-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c10ef16d7610b617cff0facc4c1b8dfce43c4ad84477360b9cfb1630065b4d6 |
|
MD5 | a7b4d077b5943dd403c78f944ee89050 |
|
BLAKE2b-256 | be19dc2a652186493a84afc4e0b9184d1addc96f20fe26a3c6587b6751387a9f |
Hashes for pillow_heif-0.1.5-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c99e3b1d365c1a78c5d3fb32420a3fadedbccbe6f813482176d0cd38f51e6952 |
|
MD5 | e36f61b03555cf2274273a48ff2844f9 |
|
BLAKE2b-256 | a38ea20a9f095bc5b581d28018a8b2dbe8a53c12db32eefad9ec06909e28c009 |
Hashes for pillow_heif-0.1.5-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 734989e308ef83833327425f66fa4f7afba87a8499054e51a8316b232b82f8bd |
|
MD5 | 8b7b0ef58804672865ac2eb1b3524c08 |
|
BLAKE2b-256 | 5df0bc19079b17b95b3f39455be17579443aa3a3adaa76b70aca6d68f610a526 |
Hashes for pillow_heif-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2feaa48f4a40683e72d4c7e3edf7a807f0a6963d12f5222489c1748026110c3 |
|
MD5 | 1cca61fcb1adbf246c1de2db641d76a3 |
|
BLAKE2b-256 | 54b3f856f1b11ba06b8418c7e77ac6ef3105555f053b9f124abbe94cef1321ec |
Hashes for pillow_heif-0.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31bda7f4a553b66ff70089c9950be6751641ee10c165b00946f2ca126f234f12 |
|
MD5 | bf36072c1da83095181e83d0cb40c707 |
|
BLAKE2b-256 | 1877d8c020b439f1334eef86f6c9e826f86dba49ccde2bf44a09777bda15d03a |
Hashes for pillow_heif-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2929540c9940234b27387706a69a9bbcb3370ae8034462f2ae2487de7366f361 |
|
MD5 | 2ce87ca98f9c907837c5ba12683bf052 |
|
BLAKE2b-256 | 2b02f64a66e10c8d3bd096f2b9d42351912c75ae610c94e90e7666735f90abed |
Hashes for pillow_heif-0.1.5-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6045db0066010dd7226e391a7af3d1a506b0af24794b9fd12fe021be17269a4e |
|
MD5 | 6f0724ce5a3a6f136bb1e105dfab4b67 |
|
BLAKE2b-256 | f1e8174c1e724aa3ed256a5fa9e8d1cf0b20f5d84e58822d7d5e8134d845ec05 |
Hashes for pillow_heif-0.1.5-cp37-cp37m-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 962d09f5641c6e6a845994bad34e1b5bec1856d8dfa0fc7bc4118756d95c6cc3 |
|
MD5 | a606c576549a86471c1bbdba99d8fc91 |
|
BLAKE2b-256 | d1a3a25ab48294b3bf0a58c9911f514d75f3a8c3c5c09f17b4d092d32b2a9e2d |
Hashes for pillow_heif-0.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 792866e5cbac0e17b49ae9092506184297bf9ec633526170bb51ebf1a8cbc142 |
|
MD5 | bef704a88db6b0e0d6b8a84fdf772741 |
|
BLAKE2b-256 | 9ab1b001ff719e04d04ea22bac588bf9085bec3f05021a20c5aad98494212429 |
Hashes for pillow_heif-0.1.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58f247006e631bdba5386bbb783341b3fa81e5efab7e2e7343229ca3fc747ecc |
|
MD5 | 860c67ffc5c40154756a0c17495953e8 |
|
BLAKE2b-256 | a9f837d3270cf7927da7e524cc506220d7ee0875f8862f045cf54a4e56a15422 |
Hashes for pillow_heif-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2598095e1c3ed21a4ede6f41a6ebecac26f4699bb0e23672db179e9a125e06f6 |
|
MD5 | 4261923c48352e95831b88d33b21e7d8 |
|
BLAKE2b-256 | 8b197ae3906b7e929316198cbc49e3641960b6cf16596fc0a2d947fbb4bc5cd4 |