【发布时间】:2017-03-16 08:52:24
【问题描述】:
我是 python 图像编辑的新手,仍在尝试了解有关 PIL 的内容。
我正在尝试在 python 中使用 PIL 在图像上创建自己的过滤器,但 python 不允许我导入多个函数。
from PIL import Image,Imagecolor,Imagefilter...
我想在计算机中使用图像,只是熟悉在 Python 中使用模块。
当我尝试使用一个功能时,如果我只导入 ImageFilter,它会说其他人无法识别..like..
import ImageFilter
img = Image.open('imagespuppy.jpg')
out = img.filter(ImageFilter.DETAIL)
img.show()
它显示一个错误,说 undefined 'Image'
需要帮助!
【问题讨论】:
-
在您的
from PIL声明中,您没有正确地大写导入。Imagecolor必须是ImageColor,ImageFilter必须是ImageFilter。这能解决您的问题吗? -
如果您想使用 Image 类,您应该将它与 ImageFilter 以及您可能使用的库中的任何其他内容一起导入。
标签: python macos python-imaging-library