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, 73, 69)
img.save('test.jpg', 'JPEG')

Installation from source

System requirements:

Ubuntu 18.04

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

CHANGELOG

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.7.tar.gz (11.0 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.7-cp38-cp38-manylinux2014_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.8

cykooz.heif-0.7-cp37-cp37m-manylinux2014_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.7m

cykooz.heif-0.7-cp36-cp36m-manylinux2014_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.6m

cykooz.heif-0.7-cp35-cp35m-manylinux2014_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: cykooz.heif-0.7.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for cykooz.heif-0.7.tar.gz
Algorithm Hash digest
SHA256 69bfdc37acf049aa43288a74364aefb85f8ca4f00ce725a72f29c06b2683e10e
MD5 73634a1c96291823c48e53db444e7909
BLAKE2b-256 75dad1fd156be8a8cac722c8e664db4406eeca1756fa998a3665809f4d23ff07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for cykooz.heif-0.7-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28e047752968d5f62856e76ff7d46f545159fd316028c950198b2af11ae79a3c
MD5 e29d1011ba22b3f4cc24dff3ae554872
BLAKE2b-256 57a966e28afc6d495aa538b11bdccf67f8f913e27347fedd17ce287b51f90075

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for cykooz.heif-0.7-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13a18efd33dc9c5fcfb8a69cf20b3337fe446285c8d0834e23e20f91c37506e9
MD5 b131fa2b2a6a78a43669df6f050d1002
BLAKE2b-256 708827d180274e2b18241f70ca40f89c88a12ac2e7e711f2212dba5f4756e455

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

File hashes

Hashes for cykooz.heif-0.7-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de857ef531462793b078e2ed201da826a4685e8859ef7b3fc64cac3739649b72
MD5 a8c8e036921c03407a56dc4021d75bef
BLAKE2b-256 af607b78e38f1aa7ac1ae074e9bceda7a84c36f6e23755bfc7bdb3a728acff7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7-cp35-cp35m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.9

File hashes

Hashes for cykooz.heif-0.7-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83406114ac6b656ac1fb77053c57a6685cb748ec5f7aa94449adf1be9aadc9dd
MD5 6b9dd71cc5b9ba1152e4bde9ffcf80cd
BLAKE2b-256 7cc5d786447dc7a99584078305e471bb9a6d717458da5b7939b32e11a550b268

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

0.9

5 files

0.8.3

5 files

0.8

5 files

0.7.2

5 files

This release

0.7 This release

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