def scale_image(image, new_width=60):
    """压缩图片"""
    original_width, original_height = image.size  # 获取原图尺寸

    # 计算高宽比，因为输出文本有2倍行距，所以乘0.5维持高宽比
    aspect_ratio = original_height / float(original_width) * 0.5

    new_height = int(aspect_ratio * new_width)
    new_image = image.resize((new_width, new_height))
    return new_image