#!/usr/bin/python

import os, sys
import JpegImagePlugin
import Image

size = 160, 120

def thumb(inf,outf):
    im = Image.open(inf)
    im.thumbnail(size,Image.ANTIALIAS)
    im.save(outf, "JPEG")

if __name__=="__main__":
  for infile in sys.argv[1:]:
    outfile = os.path.splitext(infile)[0] + "_t" + os.path.splitext(infile)[1]
    print infile, outfile
    if infile != outfile:
      thumb(infile,outfile)
#        try:
#        except IOError:
 #           print "cannot create thumbnail for", infile


