繁体   English   中英

AttributeError:模块“ImageFilter”没有属性“BoxBlur”

[英]AttributeError: module 'ImageFilter' has no attribute 'BoxBlur'

import ImageFilter


def blur_im(path:str, output: str = "output.jpg"):
    OriImage = Image.open(path)
    OriImage.show()


    boxImage = OriImage.filter(ImageFilter.BoxBlur(5))
    boxImage.show()


    boxImage.save(output)

    return 0

调用 function 时出错。 请帮忙,为什么在调用 function 和 ImageFilter 作为属性 BoxBlur 时会出错。我已经正确地写了它,请问有什么问题请帮忙。

以下行中的错误:boxImage = OriImage.filter(ImageFilter.BoxBlur(5))

错误:AttributeError:模块“ImageFilter”没有属性“BoxBlur”

您的import声明似乎不正确。 您在 function 的第一行中使用了Image ,但是您是从哪里导入的呢? 您的意思是:如果您安装了 Pillow from PIL import Image, ImageFilter

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM