kra*_*r65 2 python image crop python-imaging-library pillow
我正在尝试使用枕头来裁剪图像,但是它似乎不起作用。我有以下代码:
im = Image.open('the_image.jpg')
print 'ORIGINAL SIZE: ', im.size
im.crop((1087, 0, 1820, 2197))
print 'CROPPED SIZE: ', im.size
Run Code Online (Sandbox Code Playgroud)
在终端上打印此:
ORIGINAL SIZE: (2908, 2197)
CROPPED SIZE: (2908, 2197)
Run Code Online (Sandbox Code Playgroud)
有人知道为什么种植似乎无效吗?欢迎所有提示!
因此,它im.crop((1087, 0, 1820, 2197))不会原位裁剪图像,但会返回裁剪后的图像。
你可以做 :
im = Image.open('the_image.jpg')
print 'ORIGINAL SIZE: ', im.size
cr=im.crop((1087, 0, 1820, 2197))
print 'CROPPED SIZE: ', cr.size
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
906 次 |
| 最近记录: |