如何在 Mac 上的 python 中从 PIL 导入多个函数
How to import multiple functions from PIL in python on Mac
我是 python 中的图像编辑新手,仍在努力弄清楚 PIL 的相关内容。
我正在尝试在 python 中使用 PIL 在图像上创建自己的滤镜,但 python 不允许我导入多个函数。
from PIL import Image,Imagecolor,Imagefilter...
我想在计算机中使用图像只是熟悉使用 Python 中的模块。
当我尝试使用一个功能时,它说其他人无法识别..比如..如果我只导入 ImageFilter
import ImageFilter
img = Image.open('imagespuppy.jpg')
out = img.filter(ImageFilter.DETAIL)
img.show()
显示未定义的错误 'Image'
需要帮助!
in python import
和 from
用于包含其他 module。假设我有一个 module math
并且它有几个功能
- sqrt(平方根)
- mod (mod卢斯)
如果我想在我的另一个文件中包含数学 module 并在没有它们的 module 名称(math
)的情况下使用它们,我将不得不做
from math import sqrt, mod
sqrt(25)
现在如果我必须使用他们的 module 名称访问函数
import math
math.sqrt(25)
进入用户案例 Image 和 ImageFilter 是 PIL module 的一部分。下面是你如何导入它
from PIL import Image, ImageFilter
img = Image.open('imagespuppy.jpg')
out = img.filter(ImageFilter.DETAIL)
img.show()
我是 python 中的图像编辑新手,仍在努力弄清楚 PIL 的相关内容。
我正在尝试在 python 中使用 PIL 在图像上创建自己的滤镜,但 python 不允许我导入多个函数。
from PIL import Image,Imagecolor,Imagefilter...
我想在计算机中使用图像只是熟悉使用 Python 中的模块。
当我尝试使用一个功能时,它说其他人无法识别..比如..如果我只导入 ImageFilter
import ImageFilter
img = Image.open('imagespuppy.jpg')
out = img.filter(ImageFilter.DETAIL)
img.show()
显示未定义的错误 'Image'
需要帮助!
in python import
和 from
用于包含其他 module。假设我有一个 module math
并且它有几个功能
- sqrt(平方根)
- mod (mod卢斯)
如果我想在我的另一个文件中包含数学 module 并在没有它们的 module 名称(math
)的情况下使用它们,我将不得不做
from math import sqrt, mod
sqrt(25)
现在如果我必须使用他们的 module 名称访问函数
import math
math.sqrt(25)
进入用户案例 Image 和 ImageFilter 是 PIL module 的一部分。下面是你如何导入它
from PIL import Image, ImageFilter
img = Image.open('imagespuppy.jpg')
out = img.filter(ImageFilter.DETAIL)
img.show()