Read transparent images as white background scikit-image python

Nagabhushan S N :

I've a transparent image (4 channels) where the 4th channel is alpha channel. I want to read the image using skimage.io.imread() method. But if I set pilmode=rgb, then the transparent part becomes black, but I want it to be white. How can I achieve this?

learner :

You can do the following:

import skimage.color
import skimage.io

image = skimage.io.imread('res/images/image.png')
image = skimage.color.rgba2rgb(image)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=13913&siteId=1