I have the following script wherein I add the path to the images in TEST_IMAGE_PATHS. My input is "test_images" folder. In "test_images" folder images are named as image0, image1, image2 etc.
Script to add images in test_images to the path is:
PATH_TO_TEST_IMAGES_DIR = 'test_images'
TEST_IMAGE_PATHS = [ os.path.join(PATH_TO_TEST_IMAGES_DIR, 'image{}.jpeg'.format(i)) for i in range(5, 7) ]
How do I modify this script such that:
I can input any type of images(not just limited to jpeg) as mentioned above. Type of image include JPG, png, jpg, etc
Images should not be named as image0, image1, image2, image3, image4, image5, image6 etc. It should not be restricted to this naming convention and should pick up all the images in the 'test_images' folder
I referred How can I iterate over files in a given directory?. as suggested, however this link explains how to reference files in the folder and add them to the path. My question has to do with modifications to do to the file after being added to the path. I am able to add files to the path using above script. I need to attach multiple extensions of images. to the existing path