PYTHON: Resize Images
import os
from PIL import Image
NEW_SIZE = (240, 240)
for root, dirnames, filenames in os.walk(os.getcwd()):
for filename in filenames:
name, ext = os.path.splitext(filename)
if not ext == '.jpg':
continue
image = Image.open(os.path.join(root, filename))
image.thumbnail(NEW_SIZE, Image.ANTIALIAS)
image.save(os.path.join(root, name + '_small' + ext), 'JPEG')