In this tutorial, we will introduce the way to draw a rectangle on an image using python pillow.
1. Import library
from PIL import Image, ImageDraw
2. Read an image
i=Image.open("test.png")
3. Use an image to create an ImageDraw object
draw=ImageDraw.Draw(i)
4. Draw a rectangle
draw.rectangle([(100,100),(350,350)],outline="red")
5. Show image
i.show()