First, we have to make sure we have the Pillow library installed. Open the command terminal, and type python, when we have the interpreter running, we type:- from PIL import Image If all goes well, we will get the out put of >>>, otherwise, we have to install pillow by type: Pip install Pillow Once we have Pillow readay, we could use the image.resize method to scale images. from PIL import Image import os.path import glob def convertjpg(jpgfile,outdir): img=Image.open(jpgfile) w,h = img.size if w>h: #decide the size by which is the smaller one, width or hight height=2013 width = int(height/h*w)#calculation else: width =2013 height = int(width/w*h) try: new_img=img.resize((width,height),Image.BILINEAR) new_img.save(os.path.join(o...
Just want to spend this life happier.