小编Ewa*_*Ewa的帖子

如何逐像素绘制正方形(Python,PIL)

在空白画布上,我想使用 Pillow 逐像素绘制一个正方形。

我尝试使用 img.putpixel((30,60), (155,155,55)) 绘制一个像素,但它没有执行任何操作。

from PIL import Image

def newImg():
    img = Image.new('RGB', (1280,768))
    img.save('sqr.png')

    return img

wallpaper = newImg()

wallpaper.show()
Run Code Online (Sandbox Code Playgroud)

python pixel python-imaging-library

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

pixel ×1

python ×1

python-imaging-library ×1