drawing a line on an image with PIL

This should work:

from PIL import Image, ImageDraw
im = Image.new('RGBA', (400, 400), (0, 255, 0, 255)) 
draw = ImageDraw.Draw(im) 
draw.line((100,200, 150,300), fill=128)

Basically using ImageDraw draw over the image, then display that image after changes, to draw a thick line pass width

draw.line((100,200, 150, 300), fill=128, width=3)

Leave a Comment