import glob
from PIL import Image

#Retriving all image names and it's path with .jpg extension from given directory path in imageNames list
imageNames = glob.glob(r"C:/Users/Juraj/source/repos/diplomka_v1.1/diplomka_v1.1/pocasie/test_snezenie/nesnezi/*.jpg")
#D:/škola/magister/2.rocnik/leto/diplomka/dataset/internet/Dataset c1/dataset_komplet/FOGGY/*.jpg
#Defining width and height of image


#Count variable to show the progress of image resized
count=17

#Creating for loop to take one image from imageNames list and resize
for i in imageNames:
	#opening image for editing
    
    img = Image.open(i)
   # img = img.convert('RGB')
    
    #using resize() to resize image
   # img.thumbnail((300, 300))
    AAA = 'NOT_SNOWING'
    #save() to save image at given path and count is the name of image eg. first image name will be 0.jpg
    img.save(r"C:/Users/Juraj/source/repos/diplomka_v1.1/diplomka_v1.1/pocasie/test_snezenie/stanovisko3//"+AAA+str(count)+".jpg") 
    #incrementing count value
    count+=1
    #showing image resize progress
    print("Images Resized " +str(count)+"/"+str(len(imageNames)),end='\r')


'''
image_list = []
resized_images = []

for filename in glob.glob('D:/škola/magister/2.rocnik/leto/diplomka/dataset/internet/Dataset c1/Dataset0/CLOUDY.jpg'):
    print(filename)
    img = Image.open(filename)
    image_list.append(img)
'''
