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 colored circle with radius r
and center (x,y)
Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. It is available for Windows, Mac OS X and Linux. The latest version of PIL is 1.1.
Python – Display Image using PIL To show or display an image in Python Pillow, you can use show() method on an image object. The show() method writes the image to a temporary file and then triggers the default program to display that image. Once the program execution is completed, the temporary file will be deleted.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With