In this post I will guide you how to write multiple images into a folder using python cv2. Images are read which you can find in my previous post on Read Multiple images from a folder using python cv2. If you face any problem in installing opencv with windows, Please visit my blog on it by clicking here.
Please follow this code as well follow the previous post on Read Multiple images from a folder using python cv2 to get synchronized with reading and writing images in python opencv
# import the library opencv
# globbing utility.
# select the path
path = "A:\images\input_images\*.*"
for bb,file in enumerate (glob.glob(path)):
image_read = cv2.imread(file)
# conversion numpy array into rgb image to show
c = cv2.cvtColor(image_read, cv2.COLOR_BGR2RGB)
# writing the images in a folder output_images
cv2.imshow('Color image', c) # wait for 1 second
k = cv2.waitKey(1000)
# destroy the window
Final screenshot of some of the images written is as below
Originally published at http://ersanpreet.wordpress.com on August 15, 2018.