background_composite¶
- background_composite(image, fill=255, *, alpha)[source]¶
Image composite with specified background.
- Parameters:
- Returns:
Image with background composite.
- Return type:
Examples
>>> from tiatoolbox.utils import transforms >>> import numpy as np >>> from matplotlib import pyplot as plt >>> img_with_alpha = np.zeros((2000, 2000, 4)).astype('uint8') >>> img_with_alpha[:1000, :, 3] = 255 # edit alpha channel >>> img_back_composite = transforms.background_composite( ... img_with_alpha ... ) >>> plt.imshow(img_with_alpha) >>> plt.imshow(img_back_composite) >>> plt.show()