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.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distributions

cykooz.heif-1.0.1-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.1-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.1-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.1-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.1-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.1.tar.gz.

File metadata

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

File hashes

Hashes for cykooz.heif-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c0fcfb2ebf9d704a8e060325f476b16ff947e450be19c3e4a987715c97c0e748
MD5 1e34b924d0bdd0a24b0fcd700263a8f9
BLAKE2b-256 12908f1b8bbc555c80a2b104c359856e1dd2ad84a84b86a83cd017e9166101d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-1.0.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e5eee834bd2fba0fe85986be5da41ce8b2efa09ffd8e304268c74af8a10b2adf
MD5 ae9ded3e88d7b6370a309436241b5258
BLAKE2b-256 4c85e7c135ff39ca1930bd9defc022bb14d5766c43245a1f6be737dfb24db55e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-1.0.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3e86396a974dc194c741b090aa2b5a4c416b476c93299b83393e9f416e163057
MD5 933fab880c0e58f373e43ba2adfbda24
BLAKE2b-256 bba5c919e8b82c292c7557ce78e1d84a0110437212ef3bc26a048b7da5e13982

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-1.0.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6fd8408a81ada576c9fc58ed2f7aaf0b1269a4ca60c2c1ab721b7e7d73cfa042
MD5 e1ad25f17978bb66156a6dca7697ef50
BLAKE2b-256 eb9a155db670c7bf9b2805ba477c7257c3551dee5758a86beca32d2e99e67c38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-1.0.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6bde5d753b5e005ef660a79f38110eddc3e9702786ffd7da849c6b79d05fac17
MD5 dfc1bf0c2c933d545e9fc9b3b7eafc41
BLAKE2b-256 83f4e53e221fb8d51771d2c2c2899e69f1a34ef2e8c60ac59185de1d273a89b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-1.0.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 09c2b4445345d0cdef73d1e173f99969af1b0fb35ac8c48d2d2209949cc076bc
MD5 5ff0f3686dda63e3d16793996b578801
BLAKE2b-256 8ed401a01183a2aa70fc3733aa284d010fab05a10bc78854da1fbba159792d1f

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