apple-hdr-heic


Nameapple-hdr-heic JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryA library/tool to decode images in HEIC/HEIF format taken on Apple devices that contain HDR gain map.
upload_time2024-11-05 19:07:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords heic heif converter decoder hdr hdr gain map iphone
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # apple-hdr-heic

A library/tool to decode photos (HEIC files) taken on an iPhone that contain HDR gain map, and convert it to a 48-bit (16-bit per channel) HDR representation as per [Rec. 2100](https://en.wikipedia.org/wiki/Rec._2100) with PQ transfer function.

Disclaimer: This project is NOT affiliated with, or endorsed by, Apple Inc. or any of its subsidiaries.

## Pre-requisites

* Python 3.10+
* [`exiftool`](https://exiftool.org/) 12.54+
  - For Ubuntu or Debian, do `sudo apt install libimage-exiftool-perl`
  - For other Linux distros, search `exiftool` using your package manager
  - For Mac or Windows, follow the instructions in website
  - For Windows, it is also available via [Scoop](https://scoop.sh/)

## Installation

Clone this repository, create a python environment and do:

```
pip install .
```

## Usage

CLI tool:

```
apple-hdr-heic-decode input.heic output.png
```

Library usage:

```py
from apple_hdr_heic import load_as_bt2100_pq, quantize_to_uint16

bt2100_pq = load_as_bt2100_pq("input.heic")
bt2100_pq_u16 = quantize_to_uint16(bt2100_pq)
cv2.imwrite("output.png", bt2100_pq_u16[:, :, ::-1])
```

The output file `output.png` does not contain the necessary [cICP](https://en.wikipedia.org/wiki/Coding-independent_code_points) metadata that denotes it to have `bt2020` (9) color primaries and `smpte2084` (16) transfer characteristics.

To convert the above PNG to a 12-bit HDR AVIF file with appropriate metadata using [libavif](https://github.com/AOMediaCodec/libavif), do:

```
avifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=10 -a tune=ssim -a color:enable-qm=1 \
    -a color:enable-chroma-deltaq=1 -d 12 --cicp 9/16/9 output.png output.avif
```

## Development

### Environment Set Up

Install [`uv`](https://github.com/astral-sh/uv).

Install `nox` using `uv`:

```
uv tool install nox
```

### Unit Testing

```
nox -s test
```

### Type Checking

```
nox -s typeck
```

### Linting

```
nox -s lint
```

### Formatting

```
nox -s style
```

### Building

```
uv tool install flit
flit build --no-use-vcs
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "apple-hdr-heic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "heic, heif, converter, decoder, HDR, HDR Gain Map, iPhone",
    "author": null,
    "author_email": "John Charankattu <john.ch.fr@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/07/b2/2d5a1c54c10765ff107ffd8ba2dc5c68a4feb434bd348b25d7812fedaac9/apple_hdr_heic-0.0.2.tar.gz",
    "platform": null,
    "description": "# apple-hdr-heic\n\nA library/tool to decode photos (HEIC files) taken on an iPhone that contain HDR gain map, and convert it to a 48-bit (16-bit per channel) HDR representation as per [Rec. 2100](https://en.wikipedia.org/wiki/Rec._2100) with PQ transfer function.\n\nDisclaimer: This project is NOT affiliated with, or endorsed by, Apple Inc. or any of its subsidiaries.\n\n## Pre-requisites\n\n* Python 3.10+\n* [`exiftool`](https://exiftool.org/) 12.54+\n  - For Ubuntu or Debian, do `sudo apt install libimage-exiftool-perl`\n  - For other Linux distros, search `exiftool` using your package manager\n  - For Mac or Windows, follow the instructions in website\n  - For Windows, it is also available via [Scoop](https://scoop.sh/)\n\n## Installation\n\nClone this repository, create a python environment and do:\n\n```\npip install .\n```\n\n## Usage\n\nCLI tool:\n\n```\napple-hdr-heic-decode input.heic output.png\n```\n\nLibrary usage:\n\n```py\nfrom apple_hdr_heic import load_as_bt2100_pq, quantize_to_uint16\n\nbt2100_pq = load_as_bt2100_pq(\"input.heic\")\nbt2100_pq_u16 = quantize_to_uint16(bt2100_pq)\ncv2.imwrite(\"output.png\", bt2100_pq_u16[:, :, ::-1])\n```\n\nThe output file `output.png` does not contain the necessary [cICP](https://en.wikipedia.org/wiki/Coding-independent_code_points) metadata that denotes it to have `bt2020` (9) color primaries and `smpte2084` (16) transfer characteristics.\n\nTo convert the above PNG to a 12-bit HDR AVIF file with appropriate metadata using [libavif](https://github.com/AOMediaCodec/libavif), do:\n\n```\navifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=10 -a tune=ssim -a color:enable-qm=1 \\\n    -a color:enable-chroma-deltaq=1 -d 12 --cicp 9/16/9 output.png output.avif\n```\n\n## Development\n\n### Environment Set Up\n\nInstall [`uv`](https://github.com/astral-sh/uv).\n\nInstall `nox` using `uv`:\n\n```\nuv tool install nox\n```\n\n### Unit Testing\n\n```\nnox -s test\n```\n\n### Type Checking\n\n```\nnox -s typeck\n```\n\n### Linting\n\n```\nnox -s lint\n```\n\n### Formatting\n\n```\nnox -s style\n```\n\n### Building\n\n```\nuv tool install flit\nflit build --no-use-vcs\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library/tool to decode images in HEIC/HEIF format taken on Apple devices that contain HDR gain map.",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/johncf/apple-hdr-heic"
    },
    "split_keywords": [
        "heic",
        " heif",
        " converter",
        " decoder",
        " hdr",
        " hdr gain map",
        " iphone"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee80972da89aa67b54f57400495094512dbff22d4f653ca3af9833e89509e071",
                "md5": "b858ece7c8e1f4126ea649dc57f2b78c",
                "sha256": "c90f3fe167fb29302076989cffde9ee77c72f4e78e951d48f8736edd87c70806"
            },
            "downloads": -1,
            "filename": "apple_hdr_heic-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b858ece7c8e1f4126ea649dc57f2b78c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 7364,
            "upload_time": "2024-11-05T19:07:41",
            "upload_time_iso_8601": "2024-11-05T19:07:41.478735Z",
            "url": "https://files.pythonhosted.org/packages/ee/80/972da89aa67b54f57400495094512dbff22d4f653ca3af9833e89509e071/apple_hdr_heic-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07b22d5a1c54c10765ff107ffd8ba2dc5c68a4feb434bd348b25d7812fedaac9",
                "md5": "5d77104c29f290c7f86a4e325e7fd39b",
                "sha256": "1bbbe16a9e89526c662dbbbd65812a5bdb99cabda59dd51220dcd6f4464bb58a"
            },
            "downloads": -1,
            "filename": "apple_hdr_heic-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5d77104c29f290c7f86a4e325e7fd39b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5745,
            "upload_time": "2024-11-05T19:07:42",
            "upload_time_iso_8601": "2024-11-05T19:07:42.990236Z",
            "url": "https://files.pythonhosted.org/packages/07/b2/2d5a1c54c10765ff107ffd8ba2dc5c68a4feb434bd348b25d7812fedaac9/apple_hdr_heic-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-05 19:07:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "johncf",
    "github_project": "apple-hdr-heic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "apple-hdr-heic"
}
        
Elapsed time: 2.23100s