imwrite
-
Description: Write an image to a file with an option to convert color space. If no path is given, write to a temporary file.
-
Parameters
- img (
np.ndarray
): The image to be written, represented as a numpy ndarray. - path (
Union[str, Path]
): The path to write the image file. If None, write to a temporary file. Default is None. - color_base (
str
): The current color space of the image. If notBGR
, the function will attempt to convert it toBGR
. Default isBGR
. - suffix (
str
): The suffix for the temporary file if path is None. Default is.jpg
.
- img (
-
Returns
- bool: Returns True if the write operation is successful, otherwise returns False.
-
Example
import docsaidkit as D
img = D.imread('lena.png')
D.imwrite(img, 'lena.jpg')