canvas(device, background=None, dither=False)¶
A canvas returns a properly-sized
PIL.ImageDrawobject onto which the caller can draw upon. As soon as the with-block completes, the resultant image is flushed onto the device.
By default, any color (other than black) will be generally treated as white when displayed on monochrome devices. However, this behaviour can be changed by adding
dither=Trueand the image will be converted from RGB space into a 1-bit monochrome image where dithering is employed to differentiate colors at the expense of resolution. If a
backgroundparameter is provided, the canvas is based on the given background. This is useful to e.g. write text on a given background image.