

def resize_image(image_path, max_width, max_height, final_path):
    img = Image.open(image_path)
    (width, height) = img.size
    wpercent = (max_width / float(width))
    new_height = (wpercent * height)
    if (new_height > max_height):
        new_height = max_height
        new_width = (width * (max_height / float(height)))
    else:
        new_width = max_width
    new_size = (int(new_width), int(new_height))
    img = img.resize(new_size, Image.ANTIALIAS)
    img.save(final_path)

dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/script/creation.py resize_image/original