BN updated with 2011 calendar pics

I have been having a real dearth of time. The last few months have been really hectic after tenCube got acquired by McAfee and I joined McAfee. There is just too much to do and time is running short.

So, after a long gap, the BN website has been now upaded with the 2011 calendar in soft copy. The pics have all been taken by members of the group and the design was done by Chaitanya, another BN member. We have amazing talent within the group.

Last year, I had been editing each pic and uploading. But this year since CV had done all the work, I only had to resize and put it up on the site. So, I wrote a small python script for resizing the huge original pics into web manageable ones. The
script reads all the images in the directory and resizes in 3 different sizes. Following is the python code - and its amazing how small a piece of code this is.

from PIL import Image
import os, glob

#adjust width and height to your needs
thumb = 200,150
small = 800,600
normal= 1600,1200

for infile in glob.glob("*.jpg"):
    file, ext = os.path.splitext(infile)
    im =
    im.thumbnail(normal,Image.ANTIALIAS) + "_normal.jpg","JPEG")
    im.thumbnail(small,Image.ANTIALIAS) + "_small.jpg","JPEG")
    im.thumbnail(thumb,Image.ANTIALIAS) + "_thumb.jpg","JPEG")
Neat eh ?

No comments:

Post a Comment