imageio.plugins.opencv.OpenCVPlugin.write#

OpenCVPlugin.write(ndimage: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | List[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]], is_batch: bool = False, params: List[int] = None) bytes | None[source]#

Save an ndimage in the ImageResource.

Parameters:
ndimageArrayLike, List[ArrayLike]

The image data that will be written to the file. It is either a single image, a batch of images, or a list of images.

is_batchbool

If True, the provided ndimage is a batch of images. If False (default), the provided ndimage is a single image. If the provided ndimage is a list of images, this parameter has no effect.

paramsList[int]

A list of parameters that will be passed to OpenCVs imwrite or imwritemulti functions. Possible values are documented in the OpenCV documentation.

Returns:
encoded_imagebytes, None

If the ImageResource is "<bytes>" the call to write returns the encoded image as a bytes string. Otherwise it returns None.