imageio.plugins.opencv.OpenCVPlugin.write#

OpenCVPlugin.write(ndimage: Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[bool | int | float | complex | str | bytes], List[Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[bool | int | float | complex | str | bytes]]]], is_batch: bool = False, params: Optional[List[int]] = None) Optional[bytes][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.