Python, Draw a circle with PIL

后端 未结 4 1328
星月不相逢
星月不相逢 2021-02-12 16:12

I am looking for a command that will draw a circle on an existing image with PIL.

im = Image.open(path)

I want a function that will draw a colo

4条回答
  •  囚心锁ツ
    2021-02-12 16:24

    image = Image.open("x.png")
    draw = ImageDraw.Draw(image)
    leftUpPoint = (x-r, y-r)
    rightDownPoint = (x+r, y+r)
    twoPointList = [leftUpPoint, rightDownPoint]
    draw.ellipse(twoPointList, fill=(255,0,0,255))
    

    refer official doc: PIL.ImageDraw.ImageDraw.ellipse(xy, fill=None, outline=None, width=0)

提交回复
热议问题