【发布时间】:2013-12-20 02:49:32
【问题描述】:
我安装了 Python Pillow 并尝试裁剪图像。
其他效果效果很好(例如,缩略图、模糊图像等)
每当我运行下面的代码时,我都会收到错误:
图块不能延伸到图片之外
test_image = test_media.file
original = Image.open(test_image)
width, height = original.size # Get dimensions
left = width/2
top = height/2
right = width/2
bottom = height/2
cropped_example = original.crop((left, top, right, bottom))
cropped_example.show()
我使用了我为 PIL 找到的裁剪示例,因为我找不到 Pillow 的裁剪示例(我认为应该是相同的)。
【问题讨论】:
标签: python-3.x image-processing python-imaging-library