Show Menu
TOPICS×

s7vampy.extract_alpha(image)

Parameter:
image
Path to image file.
Returns:
Grayscale image containing the alpha channel.
Extract the alpha channel from the provided image. Returns a grayscale image.
If the provided image does not have an alpha channel, a solid white image with the same size as the incoming image is returned.
Extracting the alpha channel from logo.png:
>>> from s7vampy import *
>>> img = open_image("TestData/logo.png")
>>> img {name='TestData/logo.png', has_alpha=True, size=(256, 126)}
>>> img.extract_alpha() {name='TestData/logo.png', has_alpha=False, size=(256, 126)}