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 (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-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5cf1cb80eef2bbfea6838a2bc9d4ca949da5e839635bb265fb2bedfc155703a |
|
MD5 | f9604053e6889b2b22ec4e8630656e70 |
|
BLAKE2b-256 | 853be509f7a48c181b2680798a3f3d7f24d63568697f5955b19dffa90b291a43 |
Hashes for cykooz.heif-0.10-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca81ecaaa9d94a389aff57bd3ba3d857ac63f314868864b6554b03a97cdf0f6f |
|
MD5 | dba93787e9dc7e9bd6657ce30a9102ed |
|
BLAKE2b-256 | 41b4bbff0528a7226c931491d62984374fe90ebe223171998103af74d024582c |
Hashes for cykooz.heif-0.10-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c97fe26f08c67563b970ecd3461de2ddb384e41c0cd8873b60d14a3d9ddc02af |
|
MD5 | 9a4652a7bb9b45822f081308d86d0056 |
|
BLAKE2b-256 | 9cd517a53ece596092dc52caeb378840fe3db78ce8c0d1bfb03e67155f6cfc08 |
Hashes for cykooz.heif-0.10-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb9f92d7ff62ed98063d3e31ada2f416eace68ff408b934a650ea4698bbaaad0 |
|
MD5 | 3041e7d6b65e99d29f91ff1cca704911 |
|
BLAKE2b-256 | 8d73d4d0cd01c83d3933f44ccd69f4a0c112faf60a93cecdd1e6714a5e3d7103 |