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, 73, 69)
img.save('test.jpg', 'JPEG')
Installation from source
System requirements:
Nightly Rust (https://www.rust-lang.org/)
libheif-dev >= 1.5 (https://github.com/strukturag/libheif)
python3-dev (tested with Python 3.6 and 3.7)
Ubuntu 18.04
$ sudo add-apt-repository ppa:strukturag/libheif
$ sudo apt-get install build-essential python3.7-dev libheif-dev curl
$ curl https://sh.rustup.rs -sSf | sh
$ source $HOME/.cargo/env
$ rustup toolchain install nightly
$ pip3 install -U setuptools setuptools-rust
$ PYTHON_SYS_EXECUTABLE=python3 pip3 install cykooz.heif
CHANGELOG
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.8-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7baac2280b76ca123d344c7f566458e6d8084a4354ce4193fb794ef3598672a |
|
MD5 | 30a81d3304c3d764a234241cbf6c9671 |
|
BLAKE2b-256 | 2b4a9a0866a43316fd8fbb47dab7589e182a4e2965529a75b845df8b17abaf3c |
Hashes for cykooz.heif-0.8-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f690828e0a4f0faa6b581b372c83253634cb964b6a7ca975594ac8f2074c75f4 |
|
MD5 | 04c3ce23dd9f0fe46fc7ac2bea3dcae1 |
|
BLAKE2b-256 | e1e5087861a7963e74cfd41879a1a6c1500b9c25537b1c09291bd756639cb472 |
Hashes for cykooz.heif-0.8-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc4a7318162b421f06c0473c158268cb5af6be5df56d379851c48633991c44c6 |
|
MD5 | 553bfd07acd69f22c91e3cff597cd8a6 |
|
BLAKE2b-256 | 0e7fcc5414081b01adc34ddf9a0ec5e5fbc8048595d579726ef4bb5659027b96 |
Hashes for cykooz.heif-0.8-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa7de30f7d16be0ab74ef3b04a534bd43ab6fa177a9968455373b26e2c9bec70 |
|
MD5 | ce5697dddc0f343534bdffd152c0c166 |
|
BLAKE2b-256 | ef55b778b66ae34ea501b01d687e31f9f046d6af773f7ff737e0074566fdb20e |