Skip to main content

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.

CHANGELOG

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:

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


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 details)

Uploaded Source

Built Distributions

cykooz.heif-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.0-cp38-cp38-manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

Details for the file cykooz.heif-1.0.0.tar.gz.

File metadata

  • Download URL: cykooz.heif-1.0.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for cykooz.heif-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bada37d8e9e48c36bf2a701d1ed85f0a459f5098b743c1e20918587eb4d9b086
MD5 95117bbc65053971cac1f88fabd04e59
BLAKE2b-256 ead705595ff50431e246de299835cbb3aa4d7ac5e3df5b77e46fd052db1515a7

See more details on using hashes here.

File details

Details for the file cykooz.heif-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file cykooz.heif-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file cykooz.heif-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file cykooz.heif-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file cykooz.heif-1.0.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page