Last active
March 7, 2016 17:11
-
-
Save alexfriant/8f65bdd7e3932b683db9 to your computer and use it in GitHub Desktop.
Modify image sizes for all images in a folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import glob, os | |
size = 800, 600 | |
for infile in glob.glob("c:/myphotos/*.jpg"): | |
file, ext = os.path.splitext(infile) | |
im = Image.open(infile) | |
im.thumbnail(size, Image.ANTIALIAS) | |
im.save(file + ".jpg", "JPEG") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment