def resize_image_to_fit_width(image, dest_w):
scale_factor = dest_w / image.size[<NUM_LIT:0>]<EOL>dest_h = image.size[<NUM_LIT:1>] * scale_factor<EOL>scaled_image = image.resize((int(dest_w), int(dest_h)), PIL.Image.ANTIALIAS)<EOL>return scaled_image<EOL>
Resize and image to fit the passed in width, keeping the aspect ratio the same

:param image: PIL.Image
:param dest_w: The desired width