def resize(img, new_width=25):
    """
    Resize the image to a new width.
    """
    (old_width, old_height) = img.size
    aspect_ratio = float(old_height) / float(old_width)
    new_height = int(aspect_ratio * new_width)
    img = img.resize((new_width, new_height))
    return img