def resize_image(fname, max_width=620):
    im = Image.open(fname)
    width, height = tuple(im.getbbox()[2:])
    print 'height =',height,' width =',width
    if width > max_width:
        wrat = max_width/float(width)
        new_w = int(width * wrat)
        new_h = int(height * wrat)
        newim = im.transform((new_w,new_h), Image.EXTENT, 
                             im.getbbox(), Image.BICUBIC)
        newim.save(fname)

#Convert dia files to png, and resize
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/docs/python-scripts/rebuild.py/resize_image/original