Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PIL选择坐标以生成图像_Python_Image_Python Imaging Library - Fatal编程技术网

Python PIL选择坐标以生成图像

Python PIL选择坐标以生成图像,python,image,python-imaging-library,Python,Image,Python Imaging Library,我想创建一个从我的坐标选择图像。所以我想把每个坐标设置成一个特定的大小和颜色,比如黑色和2X2,然后把它放在它代表的特定像素上。 我该怎么办? 功能putpixel,是否适用于我想做的事情 提前感谢使用putpixel进行此操作将很不方便,但并非不可能。既然你说你想制作多于一个像素的点,那么最好使用或eliple() 例如: import Image import ImageDraw img = Image.new("RGB", (400,400), "white") draw = Image

我想创建一个从我的坐标选择图像。所以我想把每个坐标设置成一个特定的大小和颜色,比如黑色和2X2,然后把它放在它代表的特定像素上。 我该怎么办? 功能
putpixel
,是否适用于我想做的事情


提前感谢

使用
putpixel
进行此操作将很不方便,但并非不可能。既然你说你想制作多于一个像素的点,那么最好使用或
eliple()

例如:

import Image
import ImageDraw

img = Image.new("RGB", (400,400), "white")
draw = ImageDraw.Draw(img)

coords = [(100,70), (220, 310), (200,200)]
dotSize = 2

for (x,y) in coords:
    draw.rectangle([x,y,x+dotSize-1,y+dotSize-1], fill="black")

img.show()

嗯,听起来像是python的挑战?!