Created
February 23, 2014 11:55
-
-
Save mtayseer/9170422 to your computer and use it in GitHub Desktop.
Given a directory, compress all images in it
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 sys, os | |
from PIL import Image | |
files = os.listdir(sys.argv[1]) | |
for i, f in enumerate(files): | |
fname = os.path.join(sys.argv[1], f) | |
im = Image.open(fname).save(fname) | |
print 'Compressing {} of {}'.format(i, len(files)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment