我正在开发一个网站:
- Python
- 姜戈
- 鹡鸰
在这个项目中有很多图像,它们都有一个难看的黄色边框。为了删除这个边框,我需要系统地裁剪所有图像。
每个图像都有自己的焦点区域(由 wagtail 提供的功能),一个不包括黄色边框的框。然而,用于裁剪的标准工具 wagtail 在这种情况下是无用的,为了实现我的目标,我决定使用简单的缩略图。
这是我使用 image_object 的焦点来设置裁剪操作所需的所有参数的代码示例:
parameters = {
'size': (width, height),
'crop': True,
'detail': False,
'upscale': False,
}
if image_object.has_focal_point():
focal_point = image_object.get_focal_point()
parameters['box'] = "%s,%s,%s,%s" % (
int(focal_point.left),
int(focal_point.top),
int(focal_point.right - focal_point.left),
int(focal_point.bottom - focal_point.top),
)
return get_thumbnailer(image_object.file).get_thumbnail(parameters, generate=True).url
我的问题是关于“box”参数。我在简单的缩略图文档中找不到它,但我在互联网上找到了使用示例。
谁能告诉我在哪里可以找到有关它的任何参考资料?或者至少是 get_thumbnail 方法允许的所有参数的列表?
在此先感谢 nifel87