open all images in directory python code example
Example 1: python get all images in directory
import glob
for filename in glob.iglob(root_dir + '**/*.jpg', recursive=True):
# Do something
Example 2: import all images from folder python
from PIL import Image
import glob
image_list = []
for filename in glob.glob('yourpath/*.gif'): #assuming gif
im=Image.open(filename)
image_list.append(im)