在 python 中绘制像素的最佳方法



我想知道,在python中绘制具有x和y值的像素的最简单方法是什么?

可能最简单的方法是使用 PIL(Python 映像库(,它可以在 4 行中实现:

from PIL import Image, ImageColor
im = Image.new('1', (1,1)) # create the Image of size 1 pixel 
im.putpixel((0,0), ImageColor.getcolor('black', '1')) # or whatever color you wish
im.save('simplePixel.png') # or any image format

该文档显示了许多其他 http://pillow.readthedocs.io/en/3.4.x/reference/Image.html#examples 自定义它的方法。

相关内容

最新更新