Importing images from a directory (Python) to list or dictionary

PHOTO EMBED

Mon Feb 07 2022 04:29:34 GMT+0000 (UTC)

Saved by @lahiruaruna #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)
content_copyCOPY

https://stackoverflow.com/questions/26392336/importing-images-from-a-directory-python-to-list-or-dictionary