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.10.4 (2021-02-03)
Changes
Updated version of libheif-rs to 0.13.1.
0.10.2 (2021-01-15)
Changes
Updated version of libheif-rs to 0.13.
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.10.4-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea821fc69962ddd3f8ca38c7570b9f3d609b6b4ddb7cbf650e31e72074c31c12 |
|
MD5 | 4be515da6e360196236335c908bb3b7f |
|
BLAKE2b-256 | 819c74abc0e4ba47a2ed9469d54f0f2ff75680d5baeb367e7a5f8e710f2b5858 |
Hashes for cykooz.heif-0.10.4-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 481349bd5dd7f548aebaac8b9e54bfc6b32b2a7d8e20cc7ff4482a6e02dbbd40 |
|
MD5 | 6a229b6a880feac170aa5c76331cbe8c |
|
BLAKE2b-256 | 7e1c72758785668bd81d037070b3f4f0115373e306fb064cbe3094ac4b13fe8c |
Hashes for cykooz.heif-0.10.4-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78267c7c523c909da5da51db2dde9802427883a510a18e9ded7769be3d42d0e7 |
|
MD5 | bec257955afc7a9f42e4b9268ca8984f |
|
BLAKE2b-256 | 2a21198216d2d228f9110b84a41c1e50d5133da1b644378a697eef1b382aeb32 |
Hashes for cykooz.heif-0.10.4-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 457e0522502bbd12f64ca69bbde822602f2151ba7fffb4eb3c90992a3dd05a4b |
|
MD5 | f30f2d3ecc4d57d49513b36436d28e6f |
|
BLAKE2b-256 | 5c5438632f57cf63872efd84f956da670a201e5bbaad04c52d957d113a843772 |