imwrite
-
Description: Writes an image to a file, with an optional color space conversion. If no path is provided, the image is written to a temporary file.
-
Parameters:
- img (
np.ndarray): The image to write, represented as a NumPy ndarray. - path (
Union[str, Path]): The path where the image file will be saved. IfNone, a temporary file will be created. Default isNone. - color_base (
str): The current color space of the image. If it is notBGR, the function will attempt to convert it toBGR. Default isBGR. - suffix (
str): The suffix for the temporary file ifpathisNone. Default is.jpg.
- img (
-
Return value:
- bool: Returns
Trueif the write operation is successful, otherwise returnsFalse.
- bool: Returns
-
Example:
import capybara as cb
img = cb.imread('lena.png')
cb.imwrite(img, 'lena.jpg')