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.16 (https://github.com/strukturag/libheif)
python3-dev
Rust 1.72+ (https://www.rust-lang.org/)
CLang
Ubuntu 22.04
$ sudo add-apt-repository ppa:strukturag/libheif
$ sudo add-apt-repository ppa:strukturag/libde265
$ sudo apt-get install build-essential python3-dev libheif-dev curl clang
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ source $HOME/.cargo/env
$ pip3 install .
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
cykooz.heif-0.14.0.tar.gz
(13.8 kB
view hashes)
Built Distributions
Close
Hashes for cykooz.heif-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca17ca139162790faf43c74d498201177ca72e8fe0b2adc6750d4ccb63625566 |
|
MD5 | 9a038f57392f1542ddb36fa6cee09b4d |
|
BLAKE2b-256 | e1db6fb19018859191ac8877c8692a11098984a68706287743c22e041650bdb1 |
Close
Hashes for cykooz.heif-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 382968d4ec174a736db9e41c947fe2d62705b325380fb6ea87b00168936866c0 |
|
MD5 | eb625e8ac4ef8fe5920e555f746da117 |
|
BLAKE2b-256 | 141f8492f5ae415e7302d38401d218c4726003916f1a0b69dacc06203ba1bc5a |
Close
Hashes for cykooz.heif-0.14.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fc672ee463740b55120cce24a42a0b7a07cf206d3d2d68324ec1e581050714a |
|
MD5 | 60d43814020177da8bcd6433c8221048 |
|
BLAKE2b-256 | 6b83c078765cfb854f21726c3ce581ae3f200ebbeb6f212391b3de8f55c4b75d |
Close
Hashes for cykooz.heif-0.14.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 875701bfc53a4de6bd6bb56493d34a8fe21cfe72dee80b53bb9b69c84b63b828 |
|
MD5 | f0ee003023a48f51c0608211c1a09879 |
|
BLAKE2b-256 | d7c40ce2cbba15fcabdf98b816b763d4386c84043fc60eb6a71816bfde3f4cd8 |