linear_to_srgb — GFX2D colorspace op

Data kinds: rgbrgb

Call: import fullseye as fs; fs.ledger.linear_to_srgb(img) (to call the implementation directly, import gfx2d; gfx2d.linear_to_srgb(img); from the registry, opsgfx2d.get("linear_to_srgb"))

Usage

Linear light back to sRGB encoding. Exact inverse of :func:srgb_to_linear.

> The detailed description below is the original text — the summary and the headings are translated.

式(IEC 61966-2-1): `c <= 0.0031308 なら 12.92 c`、それ以外は

`1.055 c^(1/2.4) - 0.055`。チャネルごと・画素ごとに独立。

• `img: (H, W) / (H, W, 1) / (H, W, 3) / (H, W, 4)` の float。

値は `[0, 1](許容 1e-9)でなければ ValueError` ―― 線形光の HDR 値

(1 超)は先に露光を掛けて収めること。整数配列は最大値が 1 以下のときだけ

通る(0〜255 のバッファは拒否)。bool は 0/1 として通る。NaN/Inf、複素数、

マスク配列は `ValueError`。

• `(H, W, 4)` のアルファ(4 チャネル目)は変換しない(被覆率は元々線形)。

• 返り値: 同形の float64 の複製、`[0, 1]`。

• `(3,) の 1 色や (N, 3)` の色表はこの op では受けない(画像 API)。

任意の形に掛けたいときは `imgmetrics` 側の同名関数がここへ委譲している。

`radial_light / light_mask / bloom` など線形光で計算した結果を、

ファイルに書く・画面に出す直前に 1 回だけ掛ける。二度掛けると中間調が

浮く(例外は出ない)。

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

gfx2d_scenepy -3.11 examples/gfx2d_scene.py

poc_leaf_disease_areapy -3.11 examples/poc_leaf_disease_area.py

poc_pigment_unmixingpy -3.11 examples/poc_pigment_unmixing.py

poc_white_balancepy -3.11 examples/poc_white_balance.py

Ops the type connects to (they accept rgb as input)

srgb_to_linear · blend_mode · light_mask · normal_map_decode · bloom · vignette · chromatic_aberration · film_grain

Same category (colorspace)

srgb_to_linear


*Provenance: gfx2d.py — GFX2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.