网络编程
位置:首页>> 网络编程>> Python编程>> python使用PIL模块获取图片像素点的方法

python使用PIL模块获取图片像素点的方法

作者:ABigCaiBird  发布时间:2022-07-28 10:57:57 

标签:python,PIL,图片,像素点

如下所示:


from PIL import Image
########获取图片指定像素点的像素
def getPngPix(pngPath = "aa.png",pixelX = 1,pixelY = 1):
    img_src = Image.open(pngPath)
    img_src = img_src.convert('RGBA')
    str_strlist = img_src.load()
    data = str_strlist[pixelX,pixelY]
    img_src.close()
    return data

print(getPngPix())

来源:https://blog.csdn.net/caobin0825/article/details/80338305

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com