Created
March 7, 2011 18:43
-
-
Save vsr/858956 to your computer and use it in GitHub Desktop.
script for batch resizing images using imagemagick
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
| source_path = "/media01/me/flickr/" | |
| dest_path = "./converted" | |
| import os | |
| from pipes import quote | |
| file_list = os.listdir(source_path) | |
| for f in file_list: | |
| source_file = os.path.join(source_path, f) | |
| dest_file = os.path.join( dest_path, f ) | |
| #imagemagick resize & scaling options: http://www.imagemagick.org/Usage/resize/ | |
| command = "convert %s -resize 1000x1000 %s" % ( quote(source_file), quote(dest_file) ) | |
| try: | |
| print command | |
| os.system( command ) | |
| except (e): | |
| print str(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment