PNG: write cHRM and gAMA when cICP can't describe the color space
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
The issue points to ColorConfig::get_chromaticities() and get_transfer_function_gamma() from #5521 and #5557, plus the PNG, DPX, RLA, and Targa writers; it does not name source files or tests. First read those property changes and inspect how the writers currently choose color metadata. Agree on the two proposed behaviors before implementing; done means the agreed metadata is written safely and the read-back limitations described here are accounted for.
由索引模型根据 Issue 内容生成。
描述
Now that ColorConfig::get_chromaticities() and
get_transfer_function_gamma() exist (#5521, #5557), the PNG writer could use
them for color spaces its cICP chunk can't describe. Before writing the PR, I'd
like to agree on two behavior changes, because each changes what files carry
and how they read back.
What happens today. Writing a gray PNG from each of these color spaces with
OCIO's default config, and reading it back:
| Written as | The file carries | Reads back as |
|---|---|---|
lin_p3d65_scene, srgb_p3d65_scene |
cICP | the same |
lin_ap1_scene |
gAMA 1.0 |
lin_rec709_scene |
g22_ap1_scene, g22_adobergb_scene |
nothing | srgb_rec709_scene |
lin_adobergb_scene, lin_ap0_scene |
nothing | srgb_rec709_scene |
So a file written from ACEScg reads back as linear Rec.709, and one written from
gamma 2.2 AdobeRGB as sRGB.
Proposal 1: PNG writes cHRM and gAMA when cICP can't describe the space.
When there is no cICP code and no ICC profile, the writer would take the
primaries from get_chromaticities() and a pure power from
get_transfer_function_gamma(), and write cHRM beside gAMA:
- only together: primaries without a transfer function would be half a
description, so a log or piecewise curve still gets no chunk; - not for Rec.709 primaries, where gAMA alone already says everything;
- not for primaries cHRM can't store: it holds no negative or zero
coordinate, so ACES AP0 (blue y is negative) is lost, with a debug message; - not for primaries the libPNG in use refuses. Older libPNG releases reject
some valid ones, such as ACES AP1's red (x + y > 1), and that rejection
aborts the write, so the writer would check them on a scratch structure
first.
ACEScg, gamma 2.2 AP1, AdobeRGB and the other spaces above would then carry
their primaries, which browsers and image editors honor.
Proposal 2: writers tag any linear color space as gamma 1.0. Today the gamma
that PNG, DPX, RLA and Targa write is 1.0 only for lin_rec709_scene and names
equivalent to "linear" or "scene_linear". With get_transfer_function_gamma(),
any color space with a linear transfer function would get 1.0, so linear
AdobeRGB or ACES2065-1 would no longer write no gamma at all.
The catch: reading back. OpenImageIO's PNG reader ignores cHRM today, so
these files would still read back with Rec.709 primaries in OpenImageIO, now
with the right transfer function. #5516 proposes reading cHRM and gAMA as
metadata. DPX, RLA and Targa have no field for primaries, so a linear ACEScg
DPX would read back as linear Rec.709 (as a linear ACEScg PNG already does).
Questions
- Should PNG write cHRM before OpenImageIO's own reader reads it? Other
readers would interpret these files correctly right away. - Is gamma 1.0 with unstated primaries better than no gamma for linear color
spaces in DPX, RLA and Targa?
These would be the first in-tree users of the properties #5521 added.
Assisted-by: Claude Code / Claude Opus 5.5
- 主要语言
- C++
- 星标
- 2.4k
- 派生
- 716
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 91
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AcademySoftwareFoundation/OpenImageIO 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
AcademySoftwareFoundation/OpenImageIO#5619 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 10/100
AcademySoftwareFoundation/OpenImageIO#5570 ·
维护者通常 1 天内回复
-
define which color metadata OpenImageIO trusts, and when it resolves it可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 20/100
AcademySoftwareFoundation/OpenImageIO#5516 ·
维护者通常 1 天内回复
-
recognize configured color spaces and report their primaries and gamma可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 25/100
AcademySoftwareFoundation/OpenImageIO#5514 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
AcademySoftwareFoundation/OpenImageIO#5510 · 1 条评论 ·
维护者通常 1 天内回复
查看 AcademySoftwareFoundation/OpenImageIO 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
ROCm/FastFlowLM#887 ·
维护者通常 1 天内回复
-
paraview 6.2.0 uses Abseil 20260526 symbols but does not pin libabseil (undefined symbol with libabseil 20260817)可能已有人在做 @jschueller 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 64/100
-
bug medium priority openmp tokenizer wrong result
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 92/100
apache/casbin-cpp#277 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
iamaisim/ProjectAirSim#241 ·
维护者通常 1 天内回复