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())

猜你喜欢

转载自blog.csdn.net/caobin0825/article/details/80338305