cykooz.heif


Namecykooz.heif JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/Cykooz/cykooz.heif
SummaryA decoder of HEIF format of images
upload_time2024-04-15 08:14:04
maintainerNone
docs_urlNone
authorKirill Kuzminykh <cykooz@gmail.com>
requires_python>=3.8
licenseNone
keywords heif heic libheif pil pillow
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ***********
cykooz.heif
***********

``cykooz.heif`` is simple python wrapper for the library `libheif-rs <https://crates.io/crates/libheif-rs>`_.

``RawHeifImage`` is a simple wrapper around low level HEIF-decoder.

`CHANGELOG <https://github.com/Cykooz/cykooz.heif/blob/master/CHANGES.rst>`_

Usage Examples
==============

Read HEIF-image from file:

.. code-block:: python

    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:

.. code-block:: python

    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``):

.. code-block:: python

    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:

- libheif-dev >= 1.17 (https://github.com/strukturag/libheif)
- python3-dev
- Rust 1.72+ (https://www.rust-lang.org/)
- CLang

Ubuntu 22.04
------------

.. code-block:: console

    $ sudo add-apt-repository ppa:strukturag/libheif
    $ sudo add-apt-repository ppa:strukturag/libde265
    $ sudo apt-get install build-essential python3-dev libheif-dev curl clang
    $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    $ source $HOME/.cargo/env
    $ pip3 install .


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Cykooz/cykooz.heif",
    "name": "cykooz.heif",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "heif, heic, libheif, pil, pillow",
    "author": "Kirill Kuzminykh <cykooz@gmail.com>",
    "author_email": "Kirill Kuzminykh <cykooz@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/90/8f1b8bbc555c80a2b104c359856e1dd2ad84a84b86a83cd017e9166101d5/cykooz.heif-1.0.1.tar.gz",
    "platform": null,
    "description": "***********\ncykooz.heif\n***********\n\n``cykooz.heif`` is simple python wrapper for the library `libheif-rs <https://crates.io/crates/libheif-rs>`_.\n\n``RawHeifImage`` is a simple wrapper around low level HEIF-decoder.\n\n`CHANGELOG <https://github.com/Cykooz/cykooz.heif/blob/master/CHANGES.rst>`_\n\nUsage Examples\n==============\n\nRead HEIF-image from file:\n\n.. code-block:: python\n\n    from cykooz.heif.image import RawHeifImage\n\n    img = RawHeifImage.from_path('data/test.heif')\n    assert img.width == 3024\n    assert img.height == 4032\n    assert img.mode == 'RGB'\n    assert len(img.data) == 36578304\n    assert img.stride == 9072\n    assert len(img.exif) == 2026\n\nRead HEIF-image from file-like object:\n\n.. code-block:: python\n\n    from cykooz.heif.image import RawHeifImage\n\n    with open('data/test.heif') as fp\n        img = RawHeifImage.from_stream(fp)\n        assert img.width == 3024\n        assert img.height == 4032\n\nAlso package provides an opener plugin for ``PIL`` (``Pillow``):\n\n.. code-block:: python\n\n    from PIL import Image\n    from cykooz.heif.pil import register_heif_opener\n\n    register_heif_opener()\n    img = Image.open('data/test.heif')\n    assert isinstance(img, Image.Image)\n    assert img.size == (3024, 4032)\n    assert img.mode == 'RGB'\n    assert img.getpixel((100, 100)) == (73, 74, 69)\n    img.save('test.jpg', 'JPEG')\n\nInstallation from source\n========================\n\nSystem requirements:\n\n- libheif-dev >= 1.17 (https://github.com/strukturag/libheif)\n- python3-dev\n- Rust 1.72+ (https://www.rust-lang.org/)\n- CLang\n\nUbuntu 22.04\n------------\n\n.. code-block:: console\n\n    $ sudo add-apt-repository ppa:strukturag/libheif\n    $ sudo add-apt-repository ppa:strukturag/libde265\n    $ sudo apt-get install build-essential python3-dev libheif-dev curl clang\n    $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n    $ source $HOME/.cargo/env\n    $ pip3 install .\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A decoder of HEIF format of images",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/Cykooz/cykooz.heif"
    },
    "split_keywords": [
        "heif",
        " heic",
        " libheif",
        " pil",
        " pillow"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb9a155db670c7bf9b2805ba477c7257c3551dee5758a86beca32d2e99e67c38",
                "md5": "e1ad25f17978bb66156a6dca7697ef50",
                "sha256": "6fd8408a81ada576c9fc58ed2f7aaf0b1269a4ca60c2c1ab721b7e7d73cfa042"
            },
            "downloads": -1,
            "filename": "cykooz.heif-1.0.1-cp310-cp310-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "e1ad25f17978bb66156a6dca7697ef50",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 4672589,
            "upload_time": "2024-04-15T08:13:52",
            "upload_time_iso_8601": "2024-04-15T08:13:52.253542Z",
            "url": "https://files.pythonhosted.org/packages/eb/9a/155db670c7bf9b2805ba477c7257c3551dee5758a86beca32d2e99e67c38/cykooz.heif-1.0.1-cp310-cp310-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bba5c919e8b82c292c7557ce78e1d84a0110437212ef3bc26a048b7da5e13982",
                "md5": "933fab880c0e58f373e43ba2adfbda24",
                "sha256": "3e86396a974dc194c741b090aa2b5a4c416b476c93299b83393e9f416e163057"
            },
            "downloads": -1,
            "filename": "cykooz.heif-1.0.1-cp311-cp311-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "933fab880c0e58f373e43ba2adfbda24",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 4672718,
            "upload_time": "2024-04-15T08:13:54",
            "upload_time_iso_8601": "2024-04-15T08:13:54.899328Z",
            "url": "https://files.pythonhosted.org/packages/bb/a5/c919e8b82c292c7557ce78e1d84a0110437212ef3bc26a048b7da5e13982/cykooz.heif-1.0.1-cp311-cp311-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c85e7c135ff39ca1930bd9defc022bb14d5766c43245a1f6be737dfb24db55e",
                "md5": "ae9ded3e88d7b6370a309436241b5258",
                "sha256": "e5eee834bd2fba0fe85986be5da41ce8b2efa09ffd8e304268c74af8a10b2adf"
            },
            "downloads": -1,
            "filename": "cykooz.heif-1.0.1-cp312-cp312-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ae9ded3e88d7b6370a309436241b5258",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 4672502,
            "upload_time": "2024-04-15T08:13:57",
            "upload_time_iso_8601": "2024-04-15T08:13:57.655318Z",
            "url": "https://files.pythonhosted.org/packages/4c/85/e7c135ff39ca1930bd9defc022bb14d5766c43245a1f6be737dfb24db55e/cykooz.heif-1.0.1-cp312-cp312-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ed401a01183a2aa70fc3733aa284d010fab05a10bc78854da1fbba159792d1f",
                "md5": "5ff0f3686dda63e3d16793996b578801",
                "sha256": "09c2b4445345d0cdef73d1e173f99969af1b0fb35ac8c48d2d2209949cc076bc"
            },
            "downloads": -1,
            "filename": "cykooz.heif-1.0.1-cp38-cp38-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "5ff0f3686dda63e3d16793996b578801",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 4672952,
            "upload_time": "2024-04-15T08:14:00",
            "upload_time_iso_8601": "2024-04-15T08:14:00.368133Z",
            "url": "https://files.pythonhosted.org/packages/8e/d4/01a01183a2aa70fc3733aa284d010fab05a10bc78854da1fbba159792d1f/cykooz.heif-1.0.1-cp38-cp38-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83f4e53e221fb8d51771d2c2c2899e69f1a34ef2e8c60ac59185de1d273a89b7",
                "md5": "dfc1bf0c2c933d545e9fc9b3b7eafc41",
                "sha256": "6bde5d753b5e005ef660a79f38110eddc3e9702786ffd7da849c6b79d05fac17"
            },
            "downloads": -1,
            "filename": "cykooz.heif-1.0.1-cp39-cp39-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "dfc1bf0c2c933d545e9fc9b3b7eafc41",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 4672926,
            "upload_time": "2024-04-15T08:14:03",
            "upload_time_iso_8601": "2024-04-15T08:14:03.137761Z",
            "url": "https://files.pythonhosted.org/packages/83/f4/e53e221fb8d51771d2c2c2899e69f1a34ef2e8c60ac59185de1d273a89b7/cykooz.heif-1.0.1-cp39-cp39-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12908f1b8bbc555c80a2b104c359856e1dd2ad84a84b86a83cd017e9166101d5",
                "md5": "1e34b924d0bdd0a24b0fcd700263a8f9",
                "sha256": "c0fcfb2ebf9d704a8e060325f476b16ff947e450be19c3e4a987715c97c0e748"
            },
            "downloads": -1,
            "filename": "cykooz.heif-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1e34b924d0bdd0a24b0fcd700263a8f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14320,
            "upload_time": "2024-04-15T08:14:04",
            "upload_time_iso_8601": "2024-04-15T08:14:04.797714Z",
            "url": "https://files.pythonhosted.org/packages/12/90/8f1b8bbc555c80a2b104c359856e1dd2ad84a84b86a83cd017e9166101d5/cykooz.heif-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 08:14:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Cykooz",
    "github_project": "cykooz.heif",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cykooz.heif"
}
        
Elapsed time: 0.24005s