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.12 (https://github.com/strukturag/libheif)
python3-dev
Rust 1.56+ (https://www.rust-lang.org/)
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
$ 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.13.tar.gz
(12.1 kB
view hashes)
Built Distributions
Close
Hashes for cykooz.heif-0.13-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5958991a49185313ed0fb0a41f47fd99fa22cf2d8b79d38f44445686cd24cff5 |
|
MD5 | f2bd8c4ade9ac1b8dc359fce65ad872f |
|
BLAKE2b-256 | d99a0be0805270f0d44dd29e4de54251b17856806140c65e01048150f13a6f8c |
Close
Hashes for cykooz.heif-0.13-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61bfb12c7f082183c4d6281834b25737c440e43df0672aa4469eb9f4525f98d4 |
|
MD5 | c09a551ad0813cfe66e324db5f2e8164 |
|
BLAKE2b-256 | b67165c3d9ca075c14b65751e7acd7348a8699106a46b0cd7cb205fd669e69e5 |
Close
Hashes for cykooz.heif-0.13-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca2486f7586d2797dc42d50aec1d5a4fd103e2acdfe478b09c3e7f368d2bdb5 |
|
MD5 | 2841fcce43c3b0a19b37950f03fc3069 |
|
BLAKE2b-256 | c841f7e59bb0a695ac8d7b131776e2c0dbaecedfb06da6779c9638250c29a2e3 |
Close
Hashes for cykooz.heif-0.13-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34c4f16b1264d11b9f87c3da21523f68aa4cbae5e52303de70e713130cb408cf |
|
MD5 | 440702b6958cd440bb5028fb90d4bd0c |
|
BLAKE2b-256 | 903d38ea25d5db266b2b64749354d5795e62da9a4daab2d852098d962ca81108 |
Close
Hashes for cykooz.heif-0.13-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11b44b78298b3d2d2724a2438ab0454892bbebd310801f71078787f317d1be3a |
|
MD5 | b0a734e65dfedb647da8fae7d00d77d3 |
|
BLAKE2b-256 | 4f38aea3ece456b963423bbd4ec20b58995a3c22e30c2da2015c8c769eb2e9cd |