export_image¶
-
menpo.io.export_image(image, fp, extension=None, overwrite=False)[source]¶ Exports a given image. The
fpargument can be either a Path or any Python type that acts like a file. If a file is provided, theextensionkwarg must be provided. If noextensionis provided and a str filepath is provided, then the export type is calculated based on the filepath extension.Due to the mix of string and file types, an explicit overwrite argument is used which is
Falseby default.- Parameters
image (
Image) – The image to export.fp (Path or file-like object) – The Path or file-like object to save the object at/into.
extension (str or None, optional) – The extension to use, this must match the file path if the file path is a string. Determines the type of exporter that is used.
overwrite (bool, optional) – Whether or not to overwrite a file if it already exists.
- Raises
ValueError – File already exists and
overwrite!=TrueValueError –
fpis a str and theextensionis notNoneand the two extensions do not matchValueError –
fpis a file-like object andextensionisNoneValueError – The provided extension does not match to an existing exporter type (the output type is not supported).