Show Menu
TOPICS×

s7vampy.add_alpha(image)

Add an alpha channel to an RGB image.
You can use this function to combine an RGB image with an alpha channel to create an RGBA image that can be used to create static overlapping objects.
Parameter image:
image
Path to RGB image file.
Parameter alpha:
alpha
Alpha channel to add
Returns:
RGBA image.
Adding an alpha channel to an image:
 >>> from s7vampy import *
>>> img = open_image("TestData/image.png")
>>> img
{name='TestData/image.png', has_alpha=False, size=(422, 640)}
>>> alpha = open_image("TestData/alpha.png")
>>> alpha
{name='TestData/alpha.png', has_alpha=False, size=(422, 640)}
>>> add_alpha(img, alpha)
{name='add_alpha', has_alpha=True, size=(422, 640)}