小编dul*_*lla的帖子

用Python在PIL中读取PNG

我正在用Python阅读PNG文件.我想要图像中每个像素的RGB值:

  img = Image.open(path)
  pixels = img.load()
Run Code Online (Sandbox Code Playgroud)

对于JPEG文件,像素是元组,但对于PNG,我得到一个整数.我应该如何使用Python读取PNG图像以获取像素值?

python png jpeg python-imaging-library

3
推荐指数
1
解决办法
5019
查看次数

标签 统计

jpeg ×1

png ×1

python ×1

python-imaging-library ×1