首页 > 编程 > Python > 正文

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

2019-11-25 13:31:41
字体:
来源:转载
供稿:网友

如下所示:

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

以上这篇python使用PIL模块获取图片像素点的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表