Skip to content

Instantly share code, notes, and snippets.

@vsr
Created March 7, 2011 18:43
Show Gist options
  • Save vsr/858956 to your computer and use it in GitHub Desktop.
Save vsr/858956 to your computer and use it in GitHub Desktop.
script for batch resizing images using imagemagick
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