skimage2.color.rgba2rgb#

skimage2.color.rgba2rgb(rgba, background=(1, 1, 1), *, channel_axis=-1)[source]#

RGBA to RGB conversion using alpha blending [1].

Parameters:
rgba(…, C=4, …) array_like

The image in RGBA format. By default, the final dimension denotes channels.

backgroundarray_like

The color of the background to blend the image with (3 floats between 0 to 1 - the RGB value of the background).

channel_axisint, optional

This parameter indicates which axis of the array corresponds to channels.

Added in version 0.19: channel_axis was added in 0.19.

Returns:
out(…, C=3, …) ndarray

The image in RGB format. Same dimensions as input.

Raises:
ValueError

If rgba is not at least 2D with shape (…, 4, …).

References

Examples

>>> from _skimage2 import color
>>> from _skimage2 import data
>>> img_rgba = data.logo()
>>> img_rgb = color.rgba2rgb(img_rgba)