from PIL import Image, ImageDraw
im = Image.new("RGB", (400, 300))
dr = ImageDraw.Draw(im)
dr.rectangle([(50,50), (350,250)], outline="white")
im.show()
PIL
- import lib:Pillow package modulesImage.new
- create newPIL
image objectImageDraw.Draw
- create drawing object.rectangle(
- draws rectangle(50,50), (350,250)
- rectangle top left and bottom right points coordinatesoutline
- rectangle border color.show()
- displays resulting image
group: draw
from PIL import Image, ImageDraw
im = Image.new("RGB", (400, 300))
dr = ImageDraw.Draw(im)
dr.rectangle([(50,50), (350,250)], outline="white")
im.show()