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:
libheif-dev >= 1.8 (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 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.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.8.3-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 543c02ccd17f31b2b42d247034a41bc11aba364a0144473b315b87bcf54c4e34 |
|
MD5 | 3db071653313e9ac380d420807acc2fd |
|
BLAKE2b-256 | 05a9d0afa0d65f74685a9fb143de944261f844ff7947b5f97c97b8a6b41ef6aa |
Hashes for cykooz.heif-0.8.3-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7c7eb91d49f2719390f1793e246725b27c0981304cea5ec2bd8001573cc535a |
|
MD5 | fe4a3a0a3a0b013b4ab74d54c1f661b5 |
|
BLAKE2b-256 | 0bd90061885b5bd325375eb57e516fd9e9380324846d91221b14af927a7a5b1b |
Hashes for cykooz.heif-0.8.3-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6178adb305acad5c5946e6bec98035e69d8cb345fb3e5955c3b332002f9d3f48 |
|
MD5 | b6fb4ccb38abd242ade3c8c78f4d6362 |
|
BLAKE2b-256 | a504d40c606cba53b98b8a3651d415893b0d1416caa126153833501426c8251a |
Hashes for cykooz.heif-0.8.3-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4288c463f249759ffdbaa0302d8f08adc3ee7c76efc68a4deb965f4b2b7c1b9 |
|
MD5 | 3dcca7f0d28cdae98981c08f0becc0f4 |
|
BLAKE2b-256 | 13868eccb7d20fe8b5db7d0f720c94cf7a97a2346f469462eb40d5addb9648c4 |