class Image
The Image class represents an RGB image that can be loaded from a file
and drawn on a Canvas.
On platforms which support it, an Image can have an alpha channel and will
be rendered with transparency. (Not currently supported on any platform.)
Constructors
- Image(file = filename)
- Creates an Image from the contents of the given file. The set of
supported file formats is platform-dependent.
- Note: The file parameter must be specified using a
keyword argument.
Properties
- width
- Read only. The width of the image in pixels.
- height
- Read only. The height of the image in pixels.
- size
- Read only. The size of the image in pixels.
- bounds
- Read only. The bounding rectangle of the image. The top left
corner will always be (0, 0).
Methods
- draw(canvas, src_rect, dst_rect)
- Draws the part of the image specified by src_rect in the
area of the given canvas specified by dst_rect. If src_rect
and dst_rect are different sizes, the image is scaled to fit.
---