imageio.plugins.pillow.PillowPlugin.write

PillowPlugin.write(image, *, mode='RGB', format=None, **kwargs)

Write an ndimage to the URI specified in path.

If the URI points to a file on the current host and the file does not yet exist it will be created. If the file exists already, it will be appended if possible; otherwise, it will be replaced.

If necessary, the image is broken down along the leading dimension to fit into individual frames of the chosen format. If the format doesn’t support multiple frames, and IOError is raised.

Parameters
imagendarray

The ndimage to write.

mode{str}

Specify the image’s color format; default is RGB. Possible modes can be found at: https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes

format{str, None}

Optional format override. If omitted, the format to use is determined from the filename extension. If a file object was used instead of a filename, this parameter must always be used.

kwargs

Extra arguments to pass to pillow. If a writer doesn’t recognise an option, it is silently ignored. The available options are described in pillow’s image format documentation for each writer.