code: def scale_image(image, new_width):
      
      (original_width, original_height) = image.size
      aspect_ratio = original_height/float(original_width)
      new_height = int(aspect_ratio * new_width)
  
      # This scales it wider than tall, since characters are biased
      new_image = image.resize((new_width*2, new_height))
      return new_image
docs: Resizes an image preserving the aspect ratio.