multicolorfits.combine_multicolor_colorspace#
- multicolorfits.combine_multicolor_colorspace(im_list_colorized, colorspace='lab', blend='screen', weights=None, gamma=2.2, inverse=False, dtype=<class 'numpy.float64'>)[source]#
Combine colorized RGB layers in a perceptual color space instead of by direct RGB channel addition.
Drop-in alternative to combine_multicolor(): takes the same input (a list of colorized images from colorize_image(), i.e. the standard pipeline where to_grey_rgb applied
adjust_gamma(scaled, gamma)), and returns a display-ready [0,1] RGB image.The
'lab'color space is a stable, supported option (the recommended general alternative to classic RGB).'hsv'/'hsl'remain EXPERIMENTAL – they can shift the overall color cast for palettes that are unbalanced around the hue wheel.- Parameters:
im_list_colorized (list) – List of colorized RGB images, e.g. [ halpha_purple, co21_orange ]
colorspace (str) – ‘lab’ (default, STABLE) – combine chroma (a*,b*) as a lightness-weighted average in CIELAB; perceptually smooth, resists white-saturation. ‘hsv’ or ‘hsl’ (EXPERIMENTAL) – combine hues as brightness-weighted chroma vectors (x=s*cos(h), y=s*sin(h)); saturation falls out of the vector length.
blend (str) – How the lightness channels combine across layers: ‘screen’ (default) – 1 - prod(1 - L_i). Accumulates brightness like addition but saturates gracefully instead of clipping. ‘sum’ – clipped sum (closest to classic combine_multicolor behavior). ‘max’ – maximum (each pixel shows its brightest layer). ‘mean’ – average (best for mixing plain colors, dims composites).
weights (list or None) – Optional per-layer weight factors for the chroma combination.
gamma (float) – The gamma value used in the to_grey_rgb/colorize steps (default 2.2). Layers are converted to display-referred values (raised to
1/gamma) before the color-space math, so the output needs no further correction. Use gamma=1 if your inputs are already display-ready RGB.inverse (bool) – True inverts the lightness channel (white background) while keeping the chroma – without flipping layer hues via
hex_complement.dtype (numpy dtype) – Output dtype.
- Returns:
array – Combined display-ready RGB image, shape=[ypixels,xpixels,3] in [0,1]
Notes
Complementary hues at equal brightness cancel to grey by construction (additive light). See the module docstring for discussion.