Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

import sys
print sys.path

from PIL import Image
import os, shutil

def scale(infile, outfile, size):
   im = Image.open(infile)
   im.thumbnail(size, Image.ANTIALIAS)
   im.save(outfile, "JPEG")

print image_dir_path
print global_image_dir_path

default_image = global_image_dir_path + "default.jpg"
if os.path.isdir(image_dir_path):
   infile = image_dir_path + "default.jpg"
   if not os.path.isfile(infile):
        shutil.copy2(default_image, infile)

   scale(infile, image_dir_path + "thumbnail.jpg", [60, 60])
   scale(infile, image_dir_path + "icon.jpg", [120, 120])