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.

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 18.04

$ sudo add-apt-repository ppa:strukturag/libheif
$ sudo add-apt-repository ppa:strukturag/libde265
$ sudo apt-get install build-essential python3.7-dev libheif-dev curl
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ source $HOME/.cargo/env
$ pip3 install -U setuptools setuptools-rust
$ PYTHON_SYS_EXECUTABLE=python3 pip3 install cykooz.heif

CHANGELOG

0.10.2 (2021-01-15)

Changes

  • Updated version of libheif-rs to 0.13.

0.10 (2021-01-14)

Changes

  • Updated version of libheif-rs to 0.12.

  • Updated version of pyo3 to 0.13.1 (dropped support of Python 3.5).

0.9 (2020-09-26)

Changes

  • Updated version of libheif-rs to 0.11.

  • Updated version of pyo3 to 0.12.1.

Wheels

  • Updated version of libheif to 1.9.1.

  • Added dav1d decoder for faster decoding of AVIF images.

0.8.3 (2020-08-30)

Bug Fixes

  • Fixed building of wheels:
    • added libaom;

    • added rav1e encoder for AV1;

    • added stripping of libraries to reduce size of wheels.

0.8 (2020-08-29)

Changes

  • Updated version of libheif-rs to 0.10:
    • updated version of libheif-sys to 1.8.1;

    • added support of new compression format AV1.

  • Updated version of pyo3 to 0.11.1.

0.7.2 (2020-03-20)

Changes

  • Updated version of pyo3 to 0.9.

Bug Fixes

  • Fixed namespace declaration.

0.7 (2020-03-01)

Changes

  • Updated version of libheif-rs to 0.9.

0.6 (2019-10-03)

Changes

  • Updated version of pyo3 to 0.8.

  • Updated version of libheif-rs to 0.8.

0.5 (2019-08-28)

Changes

  • Updated version of libheif-rs to 0.6.

0.4.2 (2019-07-17)

Bug Fixes

  • Added checking of image type inside of HeifImageFile._open().

0.4 (2019-07-17)

Features

  • Added RawHeifImage.check_file_type to check by first bytes of file what it file is supported by libheif.

  • Added opener plugin for Pillow.

0.3 (2019-06-28)

Features

  • Added method for creating HeifImage from any file-like object.

0.2 (2019-06-25)

Changes

  • Added exception HeifError.

0.1 (2019-06-25)

  • Initial version.

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

Uploaded Source

Built Distributions

File details

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

File metadata

  • Download URL: cykooz.heif-0.10.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for cykooz.heif-0.10.2.tar.gz
Algorithm Hash digest
SHA256 938d93e15f68287c3e8775f5264710f3fdd64f873a7e3b6f80415ec950db63a5
MD5 07891f86fe448b436cd11d0eb1655a3b
BLAKE2b-256 de2fb4ececebec346edba12e2a238f75f9b201cc6994fa3820c429e32ad1f358

See more details on using hashes here.

File details

Details for the file cykooz.heif-0.10.2-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cykooz.heif-0.10.2-cp39-cp39-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for cykooz.heif-0.10.2-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1a3c46f1e84d47442f3ce91041fb518c260df17d6c54e99bbe8f4e6701714a2
MD5 bf507e4094e5e45bfe75af8395a6b363
BLAKE2b-256 77ef6be7d8b885e1af597203490534b916107b1f0e559571fb70fe5b8b76144f

See more details on using hashes here.

File details

Details for the file cykooz.heif-0.10.2-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cykooz.heif-0.10.2-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for cykooz.heif-0.10.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9a477c20bef81da52b90bdcbc8700bec2041a980203970b8430cdd529298d40
MD5 236b4a211057c2dd9906789d378e49d3
BLAKE2b-256 f0f8272e55bbaf843209b2d5c0ca757af708625488405b5669cf0b6c554cd112

See more details on using hashes here.

File details

Details for the file cykooz.heif-0.10.2-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cykooz.heif-0.10.2-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for cykooz.heif-0.10.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e2f9889cdb598625058826dabc8ee7b971fc2047a07e62d12531c9dbf7facba
MD5 a62783c630744cabbeb3957dea1454a9
BLAKE2b-256 8b771afdeba3505f2227732a8b390d6899ab31f98852bdfeb1c08e006880e843

See more details on using hashes here.

File details

Details for the file cykooz.heif-0.10.2-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cykooz.heif-0.10.2-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

File hashes

Hashes for cykooz.heif-0.10.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 649912266affbc20482f3133892f19b9895d183188c66cfc3f2fc8d38f766cf5
MD5 36d7463dbdebe1593c4ed83713b9c9f4
BLAKE2b-256 58f283e5675d96a9806c240987603d71ac63e23ae3d42ac032f5926929630ed9

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