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, 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.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.7.2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distributions

cykooz.heif-0.7.2-cp38-cp38-manylinux2014_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.8

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m

cykooz.heif-0.7.2-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.2.tar.gz.

File metadata

  • Download URL: cykooz.heif-0.7.2.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.2.tar.gz
Algorithm Hash digest
SHA256 31b9a0528efa651c98aa48a882b931387570e21b8eb0f70a41f3be73bea27589
MD5 04fc9021d81ca1f7f69c593494708f36
BLAKE2b-256 45f55d21f47c9bbc4781bb1b49d42ed00193dcf65299d5cc66b626d53f232133

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7.2-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/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for cykooz.heif-0.7.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1ed08b735119401a128e01e28fc27101bcbc911ee380e24e5485dc1438def05
MD5 79eb4d887e3b72a79c2c9ef3593b7f64
BLAKE2b-256 fa2d0c95e1f863f9627452a0097d544f90955e3ccf64661f953995d22d963b89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7.2-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/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for cykooz.heif-0.7.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 934428f18defb1adc5cb21f15abfb7e07ef3fc42d75746aaa7f5658d45c67419
MD5 cb587622934be020513f6e3377afd6ec
BLAKE2b-256 a91a2086864e362cc2cf311a443c674a3158d6e0c40cfd498ddabfbf72c34f53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7.2-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/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

File hashes

Hashes for cykooz.heif-0.7.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 035180a36ada74a4839a5357d2bef73c42dd0fc45f3dc220262c5bcd4f5b369d
MD5 118d74ccb147bd5850997fda7de0078f
BLAKE2b-256 0836c4b478c7c7a3ea3d9ffced31c3bf2f635ec53ce9889575720b06a013d909

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.7.2-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/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.9

File hashes

Hashes for cykooz.heif-0.7.2-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35b2589e6408749307a06a02ea3b3a52277cca04690364946659ab4fb8569882
MD5 6263194c8a707d03653db25261b2a759
BLAKE2b-256 298f02bf837685c34d8ad6bf458d850f8fd4851e185f53ca6a13e758b64d4c37

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