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.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.9.tar.gz (13.2 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.9-cp38-cp38-manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.8

cykooz.heif-0.9-cp37-cp37m-manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.7m

cykooz.heif-0.9-cp36-cp36m-manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.6m

cykooz.heif-0.9-cp35-cp35m-manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: cykooz.heif-0.9.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for cykooz.heif-0.9.tar.gz
Algorithm Hash digest
SHA256 2517b058fed8b2320ae7b1dd34d652830b78c6025127e62ad909d37a24cad529
MD5 3bf80cf639465f0e9d2f8cba272b9f00
BLAKE2b-256 c56a4eb2f5d5cc387d2a1fb8a82eca4e10a738d9d02e41698418a86082eede1e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.9-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for cykooz.heif-0.9-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5820b7f6500ea6f5db8969f69d77bedb9ccc469331b5af307f087579a9e0e4f7
MD5 667f808c1e88a610f6332daad43864cd
BLAKE2b-256 91343d047cca8a5457df0b299edac9b08571a1183ee54d6f5b3212745cfd65ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.9-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9

File hashes

Hashes for cykooz.heif-0.9-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d2506ffd337f7278913658c3ab45d571b14233b71c448697f28192e99ed6c2a6
MD5 b066fc9e49f3bda673115438512b0901
BLAKE2b-256 ab57fedd6efb08bbb3c4ee58c176d606cbf7be2a7dad40ac7a9dc258d889972f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.9-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.12

File hashes

Hashes for cykooz.heif-0.9-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d6873a546321f0c81b15b13f518f62032a9bed8e4c358bf8ec280096b80b800
MD5 1e0dc8ef75ad4de2a820e0d95d4ebb3f
BLAKE2b-256 14a0c08bf3135fdc91c975499181087c4c96319b2f7f9016de5152d03c852924

See more details on using hashes here.

File details

Details for the file cykooz.heif-0.9-cp35-cp35m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cykooz.heif-0.9-cp35-cp35m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.9

File hashes

Hashes for cykooz.heif-0.9-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e6c838ace9d2ecf30494fd0948f34b0ee84605801f7b302341f526eeae50c96
MD5 a47baccd10e77f9112757c8e1359f928
BLAKE2b-256 160ec46605b9261c4828207a5b699f2f0c81bb78612acfc1fbc4e995ae86632f

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

0.10.4

5 files

0.10.2

5 files

0.10

5 files

This release

0.9 This release

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