Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list images in directory python

import os

# specify the img directory path
path = "path/to/img/folder/"

# list files in img directory
files = os.listdir(path)

for file in files:
    # make sure file is an image
    if file.endswith(('.jpg', '.png', 'jpeg')):
        img_path = path + file

        # load file as image...
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #images #directory #python
ADD COMMENT
Topic
Name
3+8 =