A decoder of HEIF format of images
Project description
cykooz.heif is simple python wrapper for the library libheif-rs.
RawHeifImage is a simple wrapper around low level HEIF-decoder.
Usage Examples
Read HEIF-image from file:
from cykooz.heif.image import RawHeifImage
img = RawHeifImage.from_path('data/test.heif')
assert img.width == 3024
assert img.height == 4032
assert img.mode == 'RGB'
assert len(img.data) == 36578304
assert img.stride == 9072
assert len(img.exif) == 2026
Read HEIF-image from file-like object:
from cykooz.heif.image import RawHeifImage
with open('data/test.heif') as fp
img = RawHeifImage.from_stream(fp)
assert img.width == 3024
assert img.height == 4032
Also package provides an opener plugin for PIL (Pillow):
from PIL import Image
from cykooz.heif.pil import register_heif_opener
register_heif_opener()
img = Image.open('data/test.heif')
assert isinstance(img, Image.Image)
assert img.size == (3024, 4032)
assert img.mode == 'RGB'
assert img.getpixel((100, 100)) == (73, 74, 69)
img.save('test.jpg', 'JPEG')
Installation from source
System requirements:
libheif-dev >= 1.10 (https://github.com/strukturag/libheif)
python3-dev
Rust 1.39+ (https://www.rust-lang.org/)
Ubuntu 18.04
$ sudo add-apt-repository ppa:strukturag/libheif
$ sudo add-apt-repository ppa:strukturag/libde265
$ sudo apt-get install build-essential python3.7-dev libheif-dev curl
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ source $HOME/.cargo/env
$ pip3 install -U setuptools setuptools-rust
$ PYTHON_SYS_EXECUTABLE=python3 pip3 install cykooz.heif
CHANGELOG
0.11 (2021-05-12)
Changes
Updated version of libheif-rs to 0.14.
Wheels
Fixed building of libheif with dav1d and rav1e libraries.
0.10 (2021-01-14)
Changes
Updated version of libheif-rs to 0.12.
Updated version of pyo3 to 0.13.1 (dropped support of Python 3.5).
0.9 (2020-09-26)
Changes
Updated version of libheif-rs to 0.11.
Updated version of pyo3 to 0.12.1.
Wheels
Updated version of libheif to 1.9.1.
Added dav1d decoder for faster decoding of AVIF images.
0.8.3 (2020-08-30)
Bug Fixes
- Fixed building of wheels:
added libaom;
added rav1e encoder for AV1;
added stripping of libraries to reduce size of wheels.
0.8 (2020-08-29)
Changes
- Updated version of libheif-rs to 0.10:
updated version of libheif-sys to 1.8.1;
added support of new compression format AV1.
Updated version of pyo3 to 0.11.1.
0.7.2 (2020-03-20)
Changes
Updated version of pyo3 to 0.9.
Bug Fixes
Fixed namespace declaration.
0.7 (2020-03-01)
Changes
Updated version of libheif-rs to 0.9.
0.6 (2019-10-03)
Changes
Updated version of pyo3 to 0.8.
Updated version of libheif-rs to 0.8.
0.5 (2019-08-28)
Changes
Updated version of libheif-rs to 0.6.
0.4.2 (2019-07-17)
Bug Fixes
Added checking of image type inside of HeifImageFile._open().
0.4 (2019-07-17)
Features
Added RawHeifImage.check_file_type to check by first bytes of file what it file is supported by libheif.
Added opener plugin for Pillow.
0.3 (2019-06-28)
Features
Added method for creating HeifImage from any file-like object.
0.2 (2019-06-25)
Changes
Added exception HeifError.
0.1 (2019-06-25)
Initial version.
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 cykooz.heif-0.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63c1c08feb8788bb67bf3868d77dca13f37a069b51f615c2dbe9d1bf01f806a4 |
|
MD5 | c463e0f07233a2101005a3a95c1f7562 |
|
BLAKE2b-256 | bce733c5f496a49ada6f31ea46abe7e801bf68cfb0deee3865b76ed4cf69f30b |
Hashes for cykooz.heif-0.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 411c2a5eced338bf59965b131ade5364798a1dfbea576118345cb2c5214706fb |
|
MD5 | 7c86e82c34a4a8e46de41a5aac3f9ecc |
|
BLAKE2b-256 | d1b3d47d38da5d1f4f692b2b26d3a833119d5a2adf5827430153d77bc5c6122a |
Hashes for cykooz.heif-0.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf24e6f0c19d1a09d18552642764e0b3bf87fa5c7677714ee3df6d59d49e3fc |
|
MD5 | 22b25dddc77a24e54faf8b95d3d6145c |
|
BLAKE2b-256 | 26fff4d8852c90b679e5371a0f582cb365b4539e1361eb3e5cb38d2765d515d2 |
Hashes for cykooz.heif-0.11-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3eb88f531e977f11012f06a2c05ae90ee8b13920b81691e6845d6b4a7439f08 |
|
MD5 | 9f416ea8f3d8efbc0658f27c643c5995 |
|
BLAKE2b-256 | 48eba0290d65b092e920cba4b4d255cbf87c39e11deb90bd1cb7ef6a3fd71dca |