Show Menu
TOPICS×

s7vampy.create_rgba(image)

Create a RGB image with alpha channel.
Create a solid color RGBA image of the given width and height.
Color is specified as a red, green, blue, alpha tuple in the range 0-255. If alpha is omitted then it is set to 255 (solid). If green, blue, and alpha are omitted then a solid gray image is created at the specified red value.
Parameter width int:
int width
Width of the image.
Parameter height int:
int height
Height of the image.
Parameter color tuple:
color tuple
Color of the image.
Returns:
Image instance.
Creating a 200x300 solid red image:
 >>> from s7vampy import *
>>> img = create_rgba_image(200, 300, (255, 0, 0))
>>> img
{name='rgba_image', has_alpha=True, size=(200, 300)}

Creating a 200x300 solid green image:
>>> from s7vampy import *
>>> img = create_rgba_image(200, 300, 0, 255, 0)
>>> img
{name='rgba_image', has_alpha=True, size=(200, 300)}

Creating a 200x300 solid white image:
>>> from s7vampy import *
>>> img = create_rgba_image(200, 300, 255)
>>> img
{name='rgba_image', has_alpha=True, size=(200, 300)}

Creating a 200x300 solid red image at half transparency:
>>> from s7vampy import *
>>> img = create_rgba_image(200, 300, (255, 0, 0, 128))
>>> img
{name='rgba_image', has_alpha=True, size=(200, 300)}