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.17 (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-1.0.0.tar.gz
(14.2 kB
view hashes)
Built Distributions
Close
Hashes for cykooz.heif-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f1048de8260921dbed2c978b035e092e2e5fd4c6c02930a0155765d4ced631 |
|
MD5 | 1b7dce5e68eed1a425d4822c865d44a9 |
|
BLAKE2b-256 | ceea0a9858a5bed9c53f4f4b706a117c2d77dc96a5f995503f1208735c620677 |
Close
Hashes for cykooz.heif-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a924075c15a286e8053e9b7f8bd6f6ef80cd85bcb7b84102b95b3002c54ba29e |
|
MD5 | 9fd7bd475903828104956dfef45b2dc3 |
|
BLAKE2b-256 | b7e0e9eaa819b1905e19f93647f55c19837e0b5086b0e66e464ad828ede0a0d6 |
Close
Hashes for cykooz.heif-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7cd6bfa42a016938f2c92c6b538f45edc2f86ef4be468de4d5e7e4f71d550a0 |
|
MD5 | 9b09879955a2394714c31d366299df4f |
|
BLAKE2b-256 | a9e010f3f8dc02ae6c08fd8e7b9084de991cd28157caffe5093afefa75116f3b |
Close
Hashes for cykooz.heif-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e36d0c112d085c505d2064f44f4222660f19b6c659c92bf0a8793d80da5f20b5 |
|
MD5 | 4dbefa4e86a9d33219ac3c49fe5e637a |
|
BLAKE2b-256 | 1e9a3a79ebb2114a27565eed1ca615b1c1d1da80520b497babf306e7333bb24a |
Close
Hashes for cykooz.heif-1.0.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e517a4f8f1d408e59181e2d9a13e9e4ad39b7ad37b24135b229bda07f19a63f2 |
|
MD5 | 9b0a80c10f27142deb423f909e0f62e6 |
|
BLAKE2b-256 | cfb982c6e90ca53e6c790526e02cffa66a09e68b52adb83952a98e76a2956268 |