python bulk resize images code example

Example: This is the challenge section of the lab where you'll write a script that uses PIL to perform the following operations: Iterate through each file in the folder

import os
from PIL import Image

path = "\\images\\"
dst = "\\opt\\icons\\"
current_dir = os.getcwd()

images = os.listdir(current_dir+path)
print(images)

for img in images:
    im = Image.open(current_dir+path+img)
    #im.show()
    rotated_im = im.rotate(90)
    #rotated_im.show()
    resized_im = rotated_im.resize((128, 128))
    #resized_im.show()
    jpg_im = resized_im.convert("RGB")
    #jpg_im.show()
    jpg_im.save(fp=current_dir+dst+img[:-4]+'jpg', format='jpeg')