multicolorfits.flatten_rgba#

multicolorfits.flatten_rgba(rgba, background='white', gamma=1.0)[source]#

Composite an RGBA image onto a solid background color (the inverse of deblend_background()).

Per channel: C = alpha * F + (1 - alpha) * B, optionally computed in gamma-decoded linear space when gamma != 1.

Parameters:
  • rgba (array (ny, nx, 4)) – Foreground image, float [0, 1].

  • background (color) – Solid background (any matplotlib color spec).

  • gamma (float) – Encoding gamma of the inputs. 1.0 blends the stored values directly; e.g. 2.2 decodes to linear light first and re-encodes the result.

Returns:

array (ny, nx, 3) float in [0, 1]