PIL ist eine einfache und robuste Python Bibliothek zum zeichnen.
from PIL import Image, ImageDraw
image = Image.open("test.jpg")
draw = ImageDraw.Draw(image)
lines = [
[(50, 50), (50, 100)],
[(50, 100), (100, 100)],
[(100, 100), (100, 50)],
[(100, 50), (50, 50)]
]
for line in lines:
start_point = line[0]
end_point = line[1]
draw.line([start_point, end_point], fill=(255, 0, 0), width=3)
image.show()
#image.save("result.jpg")