multicolorfits.composite_over_background#
- multicolorfits.composite_over_background(rgb, background=(1.0, 1.0, 1.0), alpha=None)[source]#
Composite a black-background (premultiplied-alpha) colorized/combined image over a solid background color, or produce a transparent RGBA image.
This is the clean “inverse” (white-background) operation: a normal additive composite is already premultiplied alpha (color x value with black where there is no signal), so bright regions keep exactly their RGB colors while faint / empty regions fade to
backgroundinstead of to black.- Parameters:
rgb (array) – Combined/colorized RGB image, shape (…,3), values in [0,1], on a black background (as returned by
combine_multicolor(..., inverse=False)orcolorize_image).background (color or None) – Any matplotlib color (‘white’, ‘#204060’, (0.1,0.1,0.1), …) to composite onto, or
Noneto return a transparent RGBA image (shape (…,4)) that fades to nothing at zero signal.alpha (array or None) – Optional explicit per-pixel coverage in [0,1]. Defaults to the image ‘value’ (max channel), which is the correct premultiplied coverage for colorized layers.
- Returns:
array – RGB image (…,3) when
backgroundis a color, or RGBA (…,4) whenbackground is None.