Skip to main content

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.4 (2021-02-03)

Changes

  • Updated version of libheif-rs to 0.13.1.

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.

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

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cykooz.heif-0.10.4-cp39-cp39-manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9

cykooz.heif-0.10.4-cp38-cp38-manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8

cykooz.heif-0.10.4-cp37-cp37m-manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.7m

cykooz.heif-0.10.4-cp36-cp36m-manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: cykooz.heif-0.10.4.tar.gz
  • Upload date:
  • Size: 13.3 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.4.tar.gz
Algorithm Hash digest
SHA256 17fd9974db0dd6454f44446413b11ab4da16954c665a47321ff06f9d62c5768e
MD5 b5a00100a6cc9e30ee13be233479b161
BLAKE2b-256 af592ce5a2a0ff3c414c5d48fffa9b8f26fe520507405e34caf5bf6bbf1dae1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10.4-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.4-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea821fc69962ddd3f8ca38c7570b9f3d609b6b4ddb7cbf650e31e72074c31c12
MD5 4be515da6e360196236335c908bb3b7f
BLAKE2b-256 819c74abc0e4ba47a2ed9469d54f0f2ff75680d5baeb367e7a5f8e710f2b5858

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10.4-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.4-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 481349bd5dd7f548aebaac8b9e54bfc6b32b2a7d8e20cc7ff4482a6e02dbbd40
MD5 6a229b6a880feac170aa5c76331cbe8c
BLAKE2b-256 7e1c72758785668bd81d037070b3f4f0115373e306fb064cbe3094ac4b13fe8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10.4-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.4-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78267c7c523c909da5da51db2dde9802427883a510a18e9ded7769be3d42d0e7
MD5 bec257955afc7a9f42e4b9268ca8984f
BLAKE2b-256 2a21198216d2d228f9110b84a41c1e50d5133da1b644378a697eef1b382aeb32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10.4-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.4-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 457e0522502bbd12f64ca69bbde822602f2151ba7fffb4eb3c90992a3dd05a4b
MD5 f30f2d3ecc4d57d49513b36436d28e6f
BLAKE2b-256 5c5438632f57cf63872efd84f956da670a201e5bbaad04c52d957d113a843772

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.1

6 files

2.0.0

6 files

1.3.0

6 files

1.2.0

6 files

1.1.0

6 files

1.0.1

6 files

1.0.0

6 files

0.14.0

5 files

0.13.1

6 files

0.13

6 files

0.12

5 files

0.11

5 files

This release

0.10.4 This release

5 files

0.10.2

5 files

0.10

5 files

0.9

5 files

0.8.3

5 files

0.8

5 files

0.7.2

5 files

0.7

5 files

0.6

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page