hdr-conversion 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hdr_conversion-0.1.0/.github/workflows/ci.yml +27 -0
- hdr_conversion-0.1.0/.github/workflows/docs.yml +28 -0
- hdr_conversion-0.1.0/.github/workflows/publish.yml +46 -0
- hdr_conversion-0.1.0/.gitignore +214 -0
- hdr_conversion-0.1.0/.python-version +1 -0
- hdr_conversion-0.1.0/LICENSE +8 -0
- hdr_conversion-0.1.0/PKG-INFO +78 -0
- hdr_conversion-0.1.0/README-zhCN.md +65 -0
- hdr_conversion-0.1.0/README.md +65 -0
- hdr_conversion-0.1.0/deprecated/ultrahdr.py +306 -0
- hdr_conversion-0.1.0/docs/api/index.md +10 -0
- hdr_conversion-0.1.0/docs/examples.md +99 -0
- hdr_conversion-0.1.0/docs/gen_ref_pages.py +22 -0
- hdr_conversion-0.1.0/docs/index.md +106 -0
- hdr_conversion-0.1.0/examples/apple_heic_to_pq.py +52 -0
- hdr_conversion-0.1.0/examples/gainmap_to_pq.py +56 -0
- hdr_conversion-0.1.0/examples/metadata_manipulation.py +32 -0
- hdr_conversion-0.1.0/examples/pq_to_gainmap.py +54 -0
- hdr_conversion-0.1.0/mkdocs.yml +70 -0
- hdr_conversion-0.1.0/pyproject.toml +33 -0
- hdr_conversion-0.1.0/src/hdrconv/__init__.py +18 -0
- hdr_conversion-0.1.0/src/hdrconv/convert/__init__.py +24 -0
- hdr_conversion-0.1.0/src/hdrconv/convert/apple.py +100 -0
- hdr_conversion-0.1.0/src/hdrconv/convert/colorspace.py +74 -0
- hdr_conversion-0.1.0/src/hdrconv/convert/gainmap.py +261 -0
- hdr_conversion-0.1.0/src/hdrconv/convert/transfer.py +84 -0
- hdr_conversion-0.1.0/src/hdrconv/core/__init__.py +20 -0
- hdr_conversion-0.1.0/src/hdrconv/core/types.py +137 -0
- hdr_conversion-0.1.0/src/hdrconv/identify/__init__.py +12 -0
- hdr_conversion-0.1.0/src/hdrconv/identify/apple_heic.py +48 -0
- hdr_conversion-0.1.0/src/hdrconv/io/__init__.py +23 -0
- hdr_conversion-0.1.0/src/hdrconv/io/apple_heic.py +189 -0
- hdr_conversion-0.1.0/src/hdrconv/io/iso21496.py +797 -0
- hdr_conversion-0.1.0/src/hdrconv/io/iso22028.py +111 -0
- hdr_conversion-0.1.0/tests/test_import.py +5 -0
- hdr_conversion-0.1.0/uv.lock +960 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "develop"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main", "develop"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v4
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Set up Env
|
|
24
|
+
run: uv sync --dev
|
|
25
|
+
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: uv run pytest
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- doc
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v4
|
|
21
|
+
with:
|
|
22
|
+
enable-cache: true
|
|
23
|
+
|
|
24
|
+
- name: Create environment
|
|
25
|
+
run: uv sync --dev
|
|
26
|
+
|
|
27
|
+
- name: Build and deploy docs
|
|
28
|
+
run: uv run mkdocs gh-deploy --force
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Build and Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
check:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install uv
|
|
15
|
+
uses: astral-sh/setup-uv@v4
|
|
16
|
+
with:
|
|
17
|
+
enable-cache: true
|
|
18
|
+
|
|
19
|
+
- name: Set up Env
|
|
20
|
+
run: uv sync --dev
|
|
21
|
+
|
|
22
|
+
- name: Import Test
|
|
23
|
+
run: uv run pytest
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: check
|
|
27
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write
|
|
31
|
+
contents: read
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- name: Install uv
|
|
37
|
+
uses: astral-sh/setup-uv@v4
|
|
38
|
+
|
|
39
|
+
- name: Build package
|
|
40
|
+
run: uv build
|
|
41
|
+
|
|
42
|
+
- name: Publish to PyPI
|
|
43
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
44
|
+
with:
|
|
45
|
+
user: __token__
|
|
46
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
.DS_Store
|
|
209
|
+
|
|
210
|
+
# Test Images
|
|
211
|
+
images/
|
|
212
|
+
|
|
213
|
+
# VSCODE settings
|
|
214
|
+
.vscode/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright © 2025 <Jack Chou>
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hdr-conversion
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: tools for converting HDR images between different formats
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: colour-science>=0.4.6
|
|
8
|
+
Requires-Dist: imagecodecs>=2025.11.11
|
|
9
|
+
Requires-Dist: pillow-heif>=0.22.0
|
|
10
|
+
Requires-Dist: pillow>=11.3.0
|
|
11
|
+
Requires-Dist: pyexiftool>=0.5.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# HDR Format Conversion Tool
|
|
15
|
+
|
|
16
|
+
[简体中文](README-zhCN.md) | [English](README.md)
|
|
17
|
+
|
|
18
|
+
> Note: In alpha stage, API may change frequently. Currently, color conversion may be incorrect.
|
|
19
|
+
|
|
20
|
+
API Reference: [https://jackchou.top/hdr-conversion](https://jackchou.top/hdr-conversion/)
|
|
21
|
+
|
|
22
|
+
## Project Overview
|
|
23
|
+
|
|
24
|
+
This project provides Python-based research on HDR format parsing and writing, supporting parsing, writing, and conversion of multiple formats including UltraHDR, Adaptive Gainmap (ISO 21496-1), and pure PQ/HLG formats (ISO 22028-5).
|
|
25
|
+
|
|
26
|
+
Note: This project is for research and learning purposes only and does not aim for production readiness.
|
|
27
|
+
|
|
28
|
+
## Getting Started
|
|
29
|
+
|
|
30
|
+
To install, using `uv` (recommended):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv add hdr-conversion
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
or use `pip`:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install hdr-conversion
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The package can be imported as follows:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import hdrconv
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
### Parsing
|
|
51
|
+
|
|
52
|
+
For UltraHDR and Adaptive Gainmap formats, supports structured extraction of:
|
|
53
|
+
|
|
54
|
+
- Main image data
|
|
55
|
+
- Gainmap image data
|
|
56
|
+
- Gainmap metadata
|
|
57
|
+
|
|
58
|
+
For pure PQ/HLG formats, supports extraction of image data and related metadata.
|
|
59
|
+
|
|
60
|
+
### Writing
|
|
61
|
+
|
|
62
|
+
Writes image data and structured metadata into corresponding formats.
|
|
63
|
+
|
|
64
|
+
UltraHDR and Adaptive Gainmap formats are implemented through manual byte stream editing combined with existing library JPEG encoding capabilities, while pure PQ/HLG formats are implemented through existing libraries.
|
|
65
|
+
|
|
66
|
+
### Conversion
|
|
67
|
+
|
|
68
|
+
Calculates alternate images based on metadata to enable conversion between Gainmap and pure HDR formats.
|
|
69
|
+
|
|
70
|
+
## Reference Standards
|
|
71
|
+
|
|
72
|
+
- [UltraHDR](https://developer.android.com/media/platform/hdr-image-format): Version 1.1 released in April 2025
|
|
73
|
+
- [ISO 21496-1](https://www.iso.org/standard/86775.html)
|
|
74
|
+
- [ISO 22028-5](https://www.iso.org/standard/81863.html)
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT. Please refer to the respective LICENSE files for specific format and dependency details.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# HDR 格式转换工具
|
|
2
|
+
|
|
3
|
+
[简体中文](README-zhCN.md) | [English](README.md)
|
|
4
|
+
|
|
5
|
+
> 注意:处于开发阶段,API 可能会频繁变动。目前,颜色转换可能不正确。
|
|
6
|
+
|
|
7
|
+
API 参考文档: [https://jackchou.top/hdr-conversion](https://jackchou.top/hdr-conversion/)
|
|
8
|
+
|
|
9
|
+
## 项目简介
|
|
10
|
+
|
|
11
|
+
本项目提供基于 Python 的 HDR 格式解析与写入研究,支持包括 UltraHDR、Adaptive Gainmap (ISO 21496-1) 以及纯 PQ/HLG 格式 (ISO 22028-5) 在内的多种格式的解析、写入和转换。
|
|
12
|
+
|
|
13
|
+
注意:仅用于研究与学习,不以生产可用性为目标。
|
|
14
|
+
|
|
15
|
+
## 快速开始
|
|
16
|
+
|
|
17
|
+
使用 `uv` 安装(推荐):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv add hdr-conversion
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
或使用 `pip`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install hdr-conversion
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
可以按以下方式导入该包:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import hdrconv
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 功能
|
|
36
|
+
|
|
37
|
+
### 解析
|
|
38
|
+
|
|
39
|
+
对于 UltraHDR 和 Adaptive Gainmap 格式,支持结构化的提取以下内容:
|
|
40
|
+
|
|
41
|
+
- 主图像数据
|
|
42
|
+
- Gainmap 图像数据
|
|
43
|
+
- Gainmap 元数据
|
|
44
|
+
|
|
45
|
+
对于纯 PQ/HLG 格式,支持提取图像数据和相关元数据。
|
|
46
|
+
|
|
47
|
+
### 写入
|
|
48
|
+
|
|
49
|
+
将图像数据和结构化的元数据写入对应的格式中。
|
|
50
|
+
|
|
51
|
+
其中,UltraHDR 和 Adaptive Gainmap 格式通过手动编辑字节流与现有库提供的 JPEG 编码能力实现,而纯 PQ/HLG 格式则通过现有的库实现。
|
|
52
|
+
|
|
53
|
+
### 转换
|
|
54
|
+
|
|
55
|
+
根据元数据计算替代图像(Alternate Image),实现在 Gainmap 与纯 HDR 格式之间的转换。
|
|
56
|
+
|
|
57
|
+
## 参考标准
|
|
58
|
+
|
|
59
|
+
- [UltraHDR](https://developer.android.com/media/platform/hdr-image-format):2025年4月发布的1.1版本
|
|
60
|
+
- [ISO 21496-1](https://www.iso.org/standard/86775.html)
|
|
61
|
+
- [ISO 22028-5](https://www.iso.org/standard/81863.html)
|
|
62
|
+
|
|
63
|
+
## 许可证
|
|
64
|
+
|
|
65
|
+
MIT,具体格式和依赖请参见各自的 LICENSE 文件。
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# HDR Format Conversion Tool
|
|
2
|
+
|
|
3
|
+
[简体中文](README-zhCN.md) | [English](README.md)
|
|
4
|
+
|
|
5
|
+
> Note: In alpha stage, API may change frequently. Currently, color conversion may be incorrect.
|
|
6
|
+
|
|
7
|
+
API Reference: [https://jackchou.top/hdr-conversion](https://jackchou.top/hdr-conversion/)
|
|
8
|
+
|
|
9
|
+
## Project Overview
|
|
10
|
+
|
|
11
|
+
This project provides Python-based research on HDR format parsing and writing, supporting parsing, writing, and conversion of multiple formats including UltraHDR, Adaptive Gainmap (ISO 21496-1), and pure PQ/HLG formats (ISO 22028-5).
|
|
12
|
+
|
|
13
|
+
Note: This project is for research and learning purposes only and does not aim for production readiness.
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
To install, using `uv` (recommended):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv add hdr-conversion
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or use `pip`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install hdr-conversion
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The package can be imported as follows:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import hdrconv
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
### Parsing
|
|
38
|
+
|
|
39
|
+
For UltraHDR and Adaptive Gainmap formats, supports structured extraction of:
|
|
40
|
+
|
|
41
|
+
- Main image data
|
|
42
|
+
- Gainmap image data
|
|
43
|
+
- Gainmap metadata
|
|
44
|
+
|
|
45
|
+
For pure PQ/HLG formats, supports extraction of image data and related metadata.
|
|
46
|
+
|
|
47
|
+
### Writing
|
|
48
|
+
|
|
49
|
+
Writes image data and structured metadata into corresponding formats.
|
|
50
|
+
|
|
51
|
+
UltraHDR and Adaptive Gainmap formats are implemented through manual byte stream editing combined with existing library JPEG encoding capabilities, while pure PQ/HLG formats are implemented through existing libraries.
|
|
52
|
+
|
|
53
|
+
### Conversion
|
|
54
|
+
|
|
55
|
+
Calculates alternate images based on metadata to enable conversion between Gainmap and pure HDR formats.
|
|
56
|
+
|
|
57
|
+
## Reference Standards
|
|
58
|
+
|
|
59
|
+
- [UltraHDR](https://developer.android.com/media/platform/hdr-image-format): Version 1.1 released in April 2025
|
|
60
|
+
- [ISO 21496-1](https://www.iso.org/standard/86775.html)
|
|
61
|
+
- [ISO 22028-5](https://www.iso.org/standard/81863.html)
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT. Please refer to the respective LICENSE files for specific format and dependency details.
|