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.12.tar.gz
(7.7 kB
view hashes)
Built Distributions
Close
Hashes for cykooz.heif-0.12-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b622b3b597cb210e7c6e1478a991024a4c609259102600eaf392b1a41af873ab |
|
MD5 | 6e1fcf76c5bf73c5744def8dceb4f6ab |
|
BLAKE2b-256 | f5624720ca58b1834b22afd5308717ec35df90e6ae69b14c9751cae1cf6ed277 |
Close
Hashes for cykooz.heif-0.12-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6021e335c3e9e58cd0fdd2ed833e42597695679fa0ddf0ecb79609a75e4b0f7e |
|
MD5 | 9755ed3770b51afd03aef8fb4a20fc33 |
|
BLAKE2b-256 | e56921bb0656ca9d4ce1dc733983bd68d91ed315d051809c0b962ead62e58303 |
Close
Hashes for cykooz.heif-0.12-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 533e937d3a654df629f2663f2a27701189b08e7f62b860228aab9a69ecd71a2a |
|
MD5 | fd99809e9f0f9c4049aaa5f970f4b2d1 |
|
BLAKE2b-256 | 45021cfb4d8584e9188c729f8dbd6cbac236464af230a74595ff4d16f5e2ee5d |
Close
Hashes for cykooz.heif-0.12-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96f0fc1eee89ddcf6438cfe5028b14fa59e2beb0ed671d5b753ba5a0df6a1080 |
|
MD5 | d1d2aab122d2387ebf1bd7d44c027c10 |
|
BLAKE2b-256 | 7f19d50bec25d13ad86051195febb613d80876186d7abf01262a8a8a4492ada9 |