2948 explained code solutions for 75 technologies


python-pillowHow to draw an ellipse


from PIL import Image, ImageDraw
  
im = Image.new("RGB", (400, 300))  
dr = ImageDraw.Draw(im)
dr.ellipse([(50,50), (350,250)], outline ="white")
im.show()ctrl + c
PIL

import Pillow package modules

Image.new

create new PIL image object

ImageDraw.Draw

create drawing object

.ellipse(

draws an ellipse

(50,50), (350,250)

bounding rectangle to fit ellipse into

outline

ellipse border color

.show()

displays resulting image