Color-space compositing suite#

Side-by-side comparisons of classic RGB vs Lab / HSV / HSL on Kepler SNR and NGC 602. Prefer combine_mode='lab' with blend='screen' as the general-purpose alternative to classic RGB; treat HSV / HSL as experimental.

Guide: Color compositing. Short tutorial twin: Color-space compositing. Generator: examples/compare_colorspaces.py.

Which mode?#

Goal

Recommendation

Match classic publications

RGB

Rich overlaps, avoid white clipping

Lab / screen (GUI default)

Strong per-layer hue separation

Lab / max

Paint-like mixing

RYB + white/custom background

Hue-vector experiments

HSV / HSL (watch palette balance)

import multicolorfits as mcf

combined = mcf.combine_colorized_layers(
    colorized_layers,
    mode='lab',
    blend='screen',
    gamma=2.2,
    background='black',
)

Use the navbar plot-color control to flip light / dark figure chrome.


Kepler SNR — color spaces#

Infrared / soft X-ray / hard X-ray — purple / orange / teal (classic linear stretches; optical WFPC2 omitted — it only covers a tiny corner of the field).

Kepler SNR — RGB vs Lab / HSV / HSL Kepler SNR — RGB vs Lab / HSV / HSL (dark chrome)

Lab lightness blends#

Kepler SNR — Lab blends screen/sum/max/mean Kepler SNR — Lab blends (dark chrome)

HSV lightness blends#

Kepler SNR — HSV blends Kepler SNR — HSV blends (dark chrome)

Complementary stress test#

Equal-brightness complementary hues cancel toward grey in additive models — physics, not a bug. Palettes help when both bands must stay vivid. Soft + hard X-ray (same stretch as above) so overlaps fill the remnant, not the tiny optical corner.

Complementary orange/blue X-ray stress test Complementary orange/blue X-ray stress test (dark chrome)

NGC 602 — three bands#

Same POB palette as NGC 602 — three bands, one decision.

NGC 602 — RGB vs Lab / HSV / HSL NGC 602 — RGB vs Lab / HSV / HSL (dark chrome) NGC 602 — Lab blend variants NGC 602 — Lab blend variants (dark chrome)

Subtractive paint (RYB)#

Same NGC 602 linear stretch as the grids above; only the layer colors (R / yellow / B) and compositing mode change — so the RYB panel is comparable to classic additive, not a zscale retune.

RGB vs RYB paint mixing RGB vs RYB paint mixing (dark chrome)

Interpreting the results#

  • lab / screen — best general-purpose alternative to classic RGB; overlaps keep hue longer instead of clipping to white.

  • lab / max — preserves per-layer hues most faithfully.

  • lab / sum — closest to classic RGB inside Lab; rarely best.

  • mean — dims the composite; better for mix_colors_hex than science images.

  • hsv / hsl — can shift global cast when the palette is unbalanced around the hue wheel; keep experimental.

Reproduce#

python examples/compare_colorspaces.py   # light+dark pairs → examples/output/
python docs/make_docs_figures.py         # copy into docs/_static/compositing/

Helper pattern used by the generator (abridged):

def composite(colorized, mode, blend='screen', gamma=2.2):
    if mode == 'rgb':
        return mcf.combine_multicolor(colorized, gamma=gamma)
    return mcf.combine_multicolor_colorspace(
        colorized, colorspace=mode, blend=blend, gamma=gamma)