import cv2
import glob
images=glob.glob("*.jpg")
for image in images:
img=cv2.imread(image,0)
re=cv2.resize(img,(100,100))
cv2.imshow("Hey",re)
cv2.waitKey(500)
cv2.destroyAllWindows()
cv2.imwrite("resized_"+image,re)
As you can see, Ifirst created a list containingthe image file paths and then iterated through that list.
The loop reads each image, resizes, displays,waits for the user input key, closes the window once the key is pressed and then writes the resized image under the existing file name together with the "resized" prefix.