Answer the question
In order to leave comments, you need to log in
PIL. Why is the text not center aligned?
img = Image.open("background.jpg")
W, H = (1400, 2000)
draw = ImageDraw.Draw(img)
msg = "12345"
w, h = draw.textsize(msg)
font_pt_1 = ImageFont.truetype("bahnschrift.ttf", 72)
draw.text(((W - w)/2, 150), msg, (255, 255, 255), font=font_pt_1)
img.save('sample-out.jpg')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question