cv2.imwrite save to folder
import cv2
import os
img = cv2.imread('1.jpg', 1)
path = 'D:/OpenCV/Scripts/Images'
cv2.imwrite(os.path.join(path , 'waka.jpg'), img)
cv2.waitKey(0)
cv2.imwrite save to folder
import cv2
import os
img = cv2.imread('1.jpg', 1)
path = 'D:/OpenCV/Scripts/Images'
cv2.imwrite(os.path.join(path , 'waka.jpg'), img)
cv2.waitKey(0)
python cv2 imwrite
# Python program to explain cv2.imwrite() method
# importing cv2
import cv2
# importing os module
import os
# Image path
image_path = r'C:\Users\Rajnish\Desktop\GeeksforGeeks\geeks.png'
# Image directory
directory = r'C:\Users\Rajnish\Desktop\GeeksforGeeks'
# Using cv2.imread() method
# to read the image
img = cv2.imread(image_path)
# Change the current directory
# to specified directory
os.chdir(directory)
# List files and directories
# in 'C:/Users/Rajnish/Desktop/GeeksforGeeks'
print("Before saving image:")
print(os.listdir(directory))
# Filename
filename = 'savedImage.jpg'
# Using cv2.imwrite() method
# Saving the image
cv2.imwrite(filename, img)
# List files and directories
# in 'C:/Users / Rajnish / Desktop / GeeksforGeeks'
print("After saving image:")
print(os.listdir(directory))
print('Successfully saved')
cv2.imwrite
# importing cv2
import cv2
# Image path
image_path = "PATH2IMAGE"
# Using cv2.imread() method to read the image
img = cv2.imread(image_path)
# New Filename
filename = 'savedImage.jpg'
# Using cv2.imwrite() method Saving the image
cv2.imwrite(filename, img)
cv2.imwrite path
import cv2
image = cv2.imread('test_img.jpg')
path ='D:/save_image.jpg'
cv2.imwrite(path,image)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us