【发布时间】:2021-05-11 00:10:31
【问题描述】:
我有这个代码:
from PIL import Image, ImageColor
i = Image.new('1', (1, 1))
i.putpixel((0, 0), ImageColor.getcolor('black','1'))
i.save('simplePixel.png')
取自answer。
运行此程序会生成一个 1 像素的黑色图像。如果我将颜色更改为红色,例如:
ImageColor.getcolor('red','1')
我得到一个白色像素而不是红色。我试过黄色,绿色蓝色;它们都会产生一个白色像素。我该如何解决这个问题?
【问题讨论】:
标签: python python-imaging-library