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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m

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

File metadata

  • Download URL: cykooz.heif-0.10.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.tar.gz
Algorithm Hash digest
SHA256 9e64b62b99095d0e7a14519fd71ad4120cbb48d5b8fc4813373531f4914b2234
MD5 bce46d687800251daa6f768ed2fec42e
BLAKE2b-256 8e3588ffb0315addcbc396ecc2614737e6c7f7fe05c93532e4dacd7040cb9ce1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10-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-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5cf1cb80eef2bbfea6838a2bc9d4ca949da5e839635bb265fb2bedfc155703a
MD5 f9604053e6889b2b22ec4e8630656e70
BLAKE2b-256 853be509f7a48c181b2680798a3f3d7f24d63568697f5955b19dffa90b291a43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10-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-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ca81ecaaa9d94a389aff57bd3ba3d857ac63f314868864b6554b03a97cdf0f6f
MD5 dba93787e9dc7e9bd6657ce30a9102ed
BLAKE2b-256 41b4bbff0528a7226c931491d62984374fe90ebe223171998103af74d024582c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10-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-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c97fe26f08c67563b970ecd3461de2ddb384e41c0cd8873b60d14a3d9ddc02af
MD5 9a4652a7bb9b45822f081308d86d0056
BLAKE2b-256 9cd517a53ece596092dc52caeb378840fe3db78ce8c0d1bfb03e67155f6cfc08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cykooz.heif-0.10-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-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb9f92d7ff62ed98063d3e31ada2f416eace68ff408b934a650ea4698bbaaad0
MD5 3041e7d6b65e99d29f91ff1cca704911
BLAKE2b-256 8d73d4d0cd01c83d3933f44ccd69f4a0c112faf60a93cecdd1e6714a5e3d7103

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