#!/usr/bin/python3

from PIL import Image
import glob, os

size = 128, 128

work_path = os.getcwd()

for infile in glob.glob(work_path + "/fullsize/*.png"):
    file, ext = os.path.splitext(infile)
    with Image.open(infile) as im:
        im.thumbnail(size)
        filename = file.split('/')[-1:][0]
        im.save(work_path + "/thumbnails/" + filename + ".jpg", "JPEG")