Show Menu


Open an image file.
filename (str)
Name of the image file that is loaded into memory.
The image instance.
The supported image file formats are: BMP, JPEG, PNG, and TIFF.
Support is limited to RGB and grayscale images. Only RGB images can have an alpha channel. The alpha channel can be extracted and used as a mask using the s7vampy.image.Image.extract_alpha() method. RGBA images can also be used to build static overlapping objects using the [s7vampy.obj.Group.add_static_overlap_object()](../../c-s7vampy-api-reference/c-classes/c-objects/ method.
Grayscale images are used to for masks and illumination maps. Note that all images added to a vignette need to match the size of the vignette view image.
Opening an image:
>>> from s7vampy import *
>>> img = open_image("TestData/view.png")
>>> img {name='TestData/view.png', has_alpha=False, size=(422, 640)}

Failure while opening an image:
>>> from s7vampy import *
>>> open_image("TestData/does-not-exist.png")
Traceback (most recent call last):
RuntimeError: Open Failed: 'TestData/does-not-exist.png'