{"id":14977697,"url":"https://github.com/bigcat88/pillow_heif","last_synced_at":"2026-02-27T14:22:51.083Z","repository":{"id":37247369,"uuid":"405143758","full_name":"bigcat88/pillow_heif","owner":"bigcat88","description":"Python library for working with HEIF images and plugin for Pillow.","archived":false,"fork":false,"pushed_at":"2025-05-09T16:40:37.000Z","size":66505,"stargazers_count":250,"open_issues_count":9,"forks_count":19,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-09T17:44:24.322Z","etag":null,"topics":["avif","heic","heif","opencv","pillow","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigcat88.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-10T16:24:22.000Z","updated_at":"2025-05-09T16:40:40.000Z","dependencies_parsed_at":"2024-03-16T22:18:55.988Z","dependency_job_id":"c9005d50-a5c4-4720-b9ec-285a0b48a0f9","html_url":"https://github.com/bigcat88/pillow_heif","commit_stats":{"total_commits":812,"total_committers":12,"mean_commits":67.66666666666667,"dds":"0.29556650246305416","last_synced_commit":"1f09eff7f5f81159e014d8124094c04ced7a7cde"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcat88%2Fpillow_heif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcat88%2Fpillow_heif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcat88%2Fpillow_heif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcat88%2Fpillow_heif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigcat88","download_url":"https://codeload.github.com/bigcat88/pillow_heif/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227611,"owners_count":22035669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avif","heic","heif","opencv","pillow","python","python3"],"created_at":"2024-09-24T13:56:09.572Z","updated_at":"2026-02-27T14:22:51.074Z","avatar_url":"https://github.com/bigcat88.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pillow-heif\n\n[![Analysis \u0026 Coverage](https://github.com/bigcat88/pillow_heif/actions/workflows/analysis-coverage.yml/badge.svg)](https://github.com/bigcat88/pillow_heif/actions/workflows/analysis-coverage.yml)\n[![Nightly build](https://github.com/bigcat88/pillow_heif/actions/workflows/nightly-src-build.yml/badge.svg)](https://github.com/bigcat88/pillow_heif/actions/workflows/nightly-src-build.yml)\n[![docs](https://readthedocs.org/projects/pillow-heif/badge/?version=latest)](https://pillow-heif.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/bigcat88/pillow_heif/branch/master/graph/badge.svg?token=JY64F2OL6V)](https://codecov.io/gh/bigcat88/pillow_heif)\n\n![PythonVersion](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)\n![impl](https://img.shields.io/pypi/implementation/pillow_heif)\n![pypi](https://img.shields.io/pypi/v/pillow_heif.svg)\n[![Downloads](https://static.pepy.tech/personalized-badge/pillow-heif?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=orange\u0026left_text=Downloads)](https://pepy.tech/project/pillow-heif)\n[![Downloads](https://static.pepy.tech/personalized-badge/pillow-heif?period=month\u0026units=international_system\u0026left_color=grey\u0026right_color=orange\u0026left_text=Downloads/Month)](https://pepy.tech/project/pillow-heif)\n\n![Mac OS](https://img.shields.io/badge/mac%20os-FCC624?style=for-the-badge\u0026logoColor=white)\n![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge\u0026logo=windows\u0026logoColor=white)\n![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black)\n![Alpine Linux](https://img.shields.io/badge/Alpine_Linux-0078D6.svg?style=for-the-badge\u0026logo=alpine-linux\u0026logoColor=white)\n![Raspberry Pi](https://img.shields.io/badge/Rasberry_Pi-FCC624.svg?style=for-the-badge\u0026logo=raspberry-pi\u0026logoColor=red)\n\nPython bindings to [libheif](https://github.com/strukturag/libheif) for working with HEIF images and plugin for Pillow.\n\nFeatures:\n * Decoding of `8`, `10`, `12` bit HEIC files.\n * Encoding of `8`, `10`, `12` bit HEIC files.\n * `EXIF`, `XMP`, `IPTC` read \u0026 write support.\n * Support of multiple images in one file and a `PrimaryImage` attribute.\n * Adding \u0026 removing `thumbnails`.\n * Reading of `Depth Images`.\n * (beta) Reading of `Auxiliary Images` by [johncf](https://github.com/johncf)\n * Adding HEIF support to Pillow in one line of code as a plugin.\n\nNote: Here is a light version [pi-heif](https://pypi.org/project/pi-heif/) of this project without encoding capabilities.\n\n### Install\n```console\npython3 -m pip install -U pip\npython3 -m pip install pillow-heif\n```\n\n### Example of use as a Pillow plugin\n```python3\nfrom PIL import Image\nfrom pillow_heif import register_heif_opener\n\nregister_heif_opener()\n\nim = Image.open(\"image.heic\")  # do whatever need with a Pillow image\nim = im.rotate(13)\nim.save(f\"rotated_image.heic\", quality=90)\n```\n\n### 16 bit PNG to 10 bit HEIF using OpenCV\n```python3\nimport cv2\nimport pillow_heif\n\ncv_img = cv2.imread(\"16bit_with_alpha.png\", cv2.IMREAD_UNCHANGED)\nheif_file = pillow_heif.from_bytes(\n    mode=\"BGRA;16\",\n    size=(cv_img.shape[1], cv_img.shape[0]),\n    data=bytes(cv_img)\n)\nheif_file.save(\"RGBA_10bit.heic\", quality=-1)\n```\n\n### 8/10/12 bit HEIF to 8/16 bit PNG using OpenCV\n```python3\nimport numpy as np\nimport cv2\nimport pillow_heif\n\nheif_file = pillow_heif.open_heif(\"image.heic\", convert_hdr_to_8bit=False, bgr_mode=True)\nnp_array = np.asarray(heif_file)\ncv2.imwrite(\"image.png\", np_array)\n```\n\n### Accessing decoded image data\n```python3\nimport pillow_heif\n\nif pillow_heif.is_supported(\"image.heic\"):\n    heif_file = pillow_heif.open_heif(\"image.heic\", convert_hdr_to_8bit=False)\n    print(\"image size:\", heif_file.size)\n    print(\"image mode:\", heif_file.mode)\n    print(\"image data length:\", len(heif_file.data))\n    print(\"image data stride:\", heif_file.stride)\n```\n\n### Get decoded image data as a Numpy array\n```python3\nimport numpy as np\nimport pillow_heif\n\nif pillow_heif.is_supported(\"input.heic\"):\n    heif_file = pillow_heif.open_heif(\"input.heic\")\n    np_array = np.asarray(heif_file)\n```\n\n### Accessing Depth Images\n\n```python3\nfrom PIL import Image\nfrom pillow_heif import register_heif_opener\nimport numpy as np\n\nregister_heif_opener()\n\nim = Image.open(\"../tests/images/heif_other/pug.heic\")\nif im.info[\"depth_images\"]:\n    depth_im = im.info[\"depth_images\"][0]  # Access the first depth image (usually there will be only one).\n    # Depth images are instances of `class HeifDepthImage(BaseImage)`,\n    # so work with them as you would with any usual image in pillow_heif.\n    # Depending on what you need the depth image for, you can convert it to a NumPy array or convert it to a Pillow image.\n    pil_im = depth_im.to_pillow()\n    np_im = np.asarray(depth_im)\n    print(pil_im)\n    print(pil_im.info[\"metadata\"])\n```\n\n\n### More Information\n\n- [Documentation](https://pillow-heif.readthedocs.io/)\n  - [Installation](https://pillow-heif.readthedocs.io/en/latest/installation.html)\n  - [Pillow plugin](https://pillow-heif.readthedocs.io/en/latest/pillow-plugin.html)\n  - [Using HeifFile](https://pillow-heif.readthedocs.io/en/latest/heif-file.html)\n  - [Image modes](https://pillow-heif.readthedocs.io/en/latest/image-modes.html)\n  - [Options](https://pillow-heif.readthedocs.io/en/latest/options.html)\n- [Examples](https://github.com/bigcat88/pillow_heif/tree/master/examples)\n- [Contribute](https://github.com/bigcat88/pillow_heif/blob/master/.github/CONTRIBUTING.md)\n  - [Discussions](https://github.com/bigcat88/pillow_heif/discussions)\n  - [Issues](https://github.com/bigcat88/pillow_heif/issues)\n- [Changelog](https://github.com/bigcat88/pillow_heif/blob/master/CHANGELOG.md)\n\n### Wheels\n\n| **_Wheels table_** | macOS\u003cbr/\u003eIntel | macOS\u003cbr/\u003eSilicon | Windows\u003cbr/\u003e | musllinux* | manylinux* |\n|--------------------|:---------------:|:-----------------:|:------------:|:----------:|:----------:|\n| CPython 3.10       |        ✅        |         ✅         |      ✅       |     ✅      |     ✅      |\n| CPython 3.11       |        ✅        |         ✅         |      ✅       |     ✅      |     ✅      |\n| CPython 3.12       |        ✅        |         ✅         |      ✅       |     ✅      |     ✅      |\n| CPython 3.13       |        ✅        |         ✅         |      ✅       |     ✅      |     ✅      |\n| CPython 3.14       |        ✅        |         ✅         |      ✅       |     ✅      |     ✅      |\n| CPython 3.14t      |        ✅        |         ✅         |      ✅       |     ✅      |     ✅      |\n| PyPy 3.11 v7.3     |        ✅        |         ✅         |      ✅       |    N/A     |     ✅      |\n\n\u0026ast; **x86_64**, **aarch64** wheels.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcat88%2Fpillow_heif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigcat88%2Fpillow_heif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcat88%2Fpillow_heif/lists"}