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

Uploaded Source

Built Distributions

cykooz.heif-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

cykooz.heif-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

cykooz.heif-0.14.0-cp39-cp39-manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

cykooz.heif-0.14.0-cp38-cp38-manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

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

File metadata

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

File hashes

Hashes for cykooz.heif-0.14.0.tar.gz
Algorithm Hash digest
SHA256 b03012b21940c6b584316cc4a5db9d288837929bed6502e70b9406e653be0222
MD5 60d97dd059e6e7e2a131a14cbe6e8e3f
BLAKE2b-256 a617870e136c86614af1fd7258e48a930975266fe7ab3e4ff5144e7d61228978

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ca17ca139162790faf43c74d498201177ca72e8fe0b2adc6750d4ccb63625566
MD5 9a038f57392f1542ddb36fa6cee09b4d
BLAKE2b-256 e1db6fb19018859191ac8877c8692a11098984a68706287743c22e041650bdb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 382968d4ec174a736db9e41c947fe2d62705b325380fb6ea87b00168936866c0
MD5 eb625e8ac4ef8fe5920e555f746da117
BLAKE2b-256 141f8492f5ae415e7302d38401d218c4726003916f1a0b69dacc06203ba1bc5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-0.14.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2fc672ee463740b55120cce24a42a0b7a07cf206d3d2d68324ec1e581050714a
MD5 60d43814020177da8bcd6433c8221048
BLAKE2b-256 6b83c078765cfb854f21726c3ce581ae3f200ebbeb6f212391b3de8f55c4b75d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cykooz.heif-0.14.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 875701bfc53a4de6bd6bb56493d34a8fe21cfe72dee80b53bb9b69c84b63b828
MD5 f0ee003023a48f51c0608211c1a09879
BLAKE2b-256 d7c40ce2cbba15fcabdf98b816b763d4386c84043fc60eb6a71816bfde3f4cd8

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