November 2018
Intermediate to advanced
492 pages
12h 19m
English
We can draw lines or other geometric shapes on an image (for example, the ellipse() function to draw an ellipse) from the PIL.ImageDraw module, as shown in the next Python code snippet:
im = Image.open("../images/parrot.png")draw = ImageDraw.Draw(im)draw.ellipse((125, 125, 200, 250), fill=(255,255,255,128))del drawim.show()
The following figure shows the output image generated by running the previous code:

Read now
Unlock full access