#!/usr/bin/env python import os # # Prints the call to # stdout, and then sends it # to the OS. # def system_call(s): print s os.system(s) # # Clear out the directories. "small" # contains thumbnails, and "medium" # contains web-sized photographs. # for d in ("small", "medium"): system_call("rm -rf " + d) system_call("mkdir " + d) files = os.listdir("photographs") for file in files: if file != ".directory": system_call("convert -resize 640x480 photographs/" + file + " medium/" + file) system_call("convert -resize 160x120 medium/" + file + " small/" + file)