使用PIL

时间:2016-01-12 23:52:45

标签: python image save python-imaging-library

我正在尝试使用getbbox裁剪图片然后保存。但是我继续得到一个我不知道如何解决的错误。

代码:

 import ImageOps
 import Image

 im=Image.open("b1.jpg")
 invert_im = ImageOps.invert(im) # because the boundary is white so I convert it to black so I can crop the photo
 im2 =invert_im.getbbox() 
 invert_im = ImageOps.invert(im2) # invert back
 invert_im.save("b1_cropped.jpg") 

我收到的错误:

AttributeError: 'tuple' object has no attribute 'save'

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

brew

这应该是答案。

相关问题