【发布时间】:2015-06-08 21:32:38
【问题描述】:
我们有以下代码:
img = Image.open(FileSystemStorage().path(relpath))
coords = [
cd['crop_start_x'],
cd['crop_start_y'],
cd['crop_end_x'],
cd['crop_end_y']
]
cropped_img = img.crop(coords)
cropped_path = "%s-cropped%s" % os.path.splitext(relpath)
tasks.delete_temporary_file.delay(fss.path(relpath))
cropped_img.save(fss.path(cropped_path))
在尝试保存裁剪后的图像时,我们得到一个奇怪的“量化表的数量不是有效的。应该在 1 到 4 之间。”例外,只是在我们的一种环境中。 最奇怪的部分是代码有时可能会工作即使裁剪或图像没有改变
有人对此有领导吗?
我们正在使用 Pillow 2.8.1、python 2.7.6 和 Ubuntu 服务器 12.04
【问题讨论】:
-
那个环境有什么不同吗?
-
我们已经检查了一切......从操作系统包到 Pillow 版本,尝试重新安装 Pillow 等等......仍然没有运气
-
您是否有任何可能与 Pillow 冲突的 PIL 安装?
-
你是如何导入 Image 类的?
标签: python python-2.7 python-imaging-library