image(path, x=0, y=0, width=None, height=None, alpha=1.0, data=None, draw=True)¶
Place an image on the canvas with (x,y) as its top left corner. Both bitmap and SVG images can be used; in the case of SVG images, the result is rendered as paths (not bitmaps).
heightare specified, the image is resized to fit. The
alphaparameter (0-1) controls the image opacity.
A filename is expected, but you can use the
dataargument instead to pass image data as a string or file-like object.
image("source/images/sign.jpg", 0, 0, 100, 100)
Get the dimensions of an image file as a (width, height) tuple.