multicolorfits.combine_multicolor_alpha#

multicolorfits.combine_multicolor_alpha(im_list_colorized, background='white', mode='rgb', gamma=2.2, weights=None, dtype=<class 'numpy.float64'>)[source]#

Combine colorized layers by compositing over a chosen background.

Drop-in alternative to combine_multicolor() and combine_multicolor_colorspace() when you want:

  • a white (or custom) background without the legacy 1 - image inverse (which also flips hues);

  • paint-like mixing with mode='ryb' (yellow + blue → green);

  • print-ink mixing with mode='cmyk';

  • transparent PNG output with background=None (RGBA that fades out at zero signal).

Parameters:
  • im_list_colorized (list) – Colorized RGB layers from colorize_image() (black background).

  • background (color or None) – Solid background ('white', hex, name, or RGB tuple), or None for a transparent RGBA result.

  • mode (str) – 'rgb' (additive), 'ryb' (subtractive / paint), or 'cmyk' (print ink). Same keyword vocabulary as combine_colorized_layers and ComposeState.combine_mode.

  • gamma (float) – Gamma used when layers were built; values are converted to display-referred space (** (1/gamma)) before compositing. Use 1.0 if inputs are already display-ready.

  • weights (list or None) – Optional per-layer weights on each layer’s coverage / pigment.

  • dtype (numpy dtype) – Output dtype.

Returns:

array – RGB (..., 3) if background is a color, else RGBA (..., 4).

Examples

>>> out = combine_multicolor_alpha(  
...     [col_ir, col_opt], background='white', mode='ryb', gamma=2.2)