Show Menu
TOPICS×

s7vampy.invert_alpha(image)

Parameter:
image
Path to image file.
Returns:
Inverted image.
Return an image where each color channel has been inverted.
This function is typically used with masks. Vignettes use mask images where white masks out the object from the background. If you encounter a mask image where blacks mask out the object from the background, you can use this function to invert that image so it can be used to build a vignette.
Inverting the mask stored in mask.png:
>>> from s7vampy import *
>>> img = open_image("TestData/mask.png")
>>> img {name='TestData/mask.png', has_alpha=False, size=(422, 640)}
>>> img2 = img.invert()
>>> img2 {name='TestData/mask.png', has_alpha=False, size=(422, 640)}