OpenCV’s imwrite to save an image in a specific location with python code

OpenCV’s imwrite
function is used to save images in a specific location.
True
OpenCV’s imwrite
saves images to the file path specified. Here we are saving the file name image.jpg
to a location C:/Users/admin/Downloads
with a new name saved_image.jpg
.
Spark notes:
- The output of the above code will be
False
in the absence of that specific location. imwrite
will overwrite existing files without outputting an error or asking for confirmation.- Image of any format can be saved using this method. The format of the image is defined by the filename’s extension (
.jpg
,.png
, etc.). - One can save any image from any location to another using this method.
Reference:
[1]Chris Albon, Machine Learning with Python Cookbook: Practical Solutions from Preprocessing to Deep Learning(2018), O’Reilly Media