Created
August 17, 2018 02:25
-
-
Save JasonCrowe/9cf034d3c5f32e347e7d7a3680739748 to your computer and use it in GitHub Desktop.
make image into thumbnail
This file contains hidden or 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
import os, sys | |
import Image | |
size = 128, 128 | |
for infile in sys.argv[1:]: | |
outfile = os.path.splitext(infile)[0] + ".thumbnail" | |
if infile != outfile: | |
try: | |
im = Image.open(infile) | |
im.thumbnail(size, Image.ANTIALIAS) | |
im.save(outfile, "JPEG") | |
except IOError: | |
print "cannot create thumbnail for '%s'" % infile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment