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.1.tar.gz
(12.2 kB
view hashes)
Built Distributions
Close
Hashes for cykooz.heif-0.13.1-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf29b43d11a6ad56e7d2b241d267b7a6d401315ddfb5442334a9a5f90e4e8db6 |
|
MD5 | 5f0bd520b3ad4ebb60c35e214b121a0a |
|
BLAKE2b-256 | 82dadb8982163b71efc8ff997fc4dba595cd600cb8b30df84e4d29e5f639e496 |
Close
Hashes for cykooz.heif-0.13.1-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f1ea27447cf6d7c73178e6abb0adf6cac66483f05fbc10de540661641a9b3d |
|
MD5 | 75cc6066d3b349639395b661bde9c02c |
|
BLAKE2b-256 | e637f8f6b7d6c2186ed13a244b5abb7ebd6cb1b4c71d94c1f1c4ecfbd0e0bf96 |
Close
Hashes for cykooz.heif-0.13.1-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8d7814cd96caa694e858d225fbf726f0e5033edf3fe4c5277c2cea4a40084e6 |
|
MD5 | 3d21ff6e3ef389df0e19d9a125b2adf6 |
|
BLAKE2b-256 | 620fc4d2664385cc9d637166e4264a397d9205a16acad087c43e01281dfe2508 |
Close
Hashes for cykooz.heif-0.13.1-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2996c7aa05e7e6073dbc48d888648c531a9e5e46cf6a39b746a643e18c54236 |
|
MD5 | 8a242dad31c06fcf091ef5c9b6dc3107 |
|
BLAKE2b-256 | 45754ef2f560037f1b0244982e84d2752370ed003c46c46c0cd5be4fff935117 |
Close
Hashes for cykooz.heif-0.13.1-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8424dea6df85c3f15595811e61dae5ef4141e99885b6a29c435ea1fa0e1b053 |
|
MD5 | b4882856eeca8030aa8bf0c51a11009c |
|
BLAKE2b-256 | ef1e8ccc8956e40c5a99246c41735591f6b9993a59b990f389222e597b96da1b |