Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pil format multiline text

import textwrap
lines = textwrap.wrap(text, width=40)
y_text = h
for line in lines:
    width, height = font.getsize(line)
    draw.text(((w - width) / 2, y_text), line, font=font, fill=FOREGROUND)
    y_text += height
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pil #format #multiline #text
ADD COMMENT
Topic
Name
4+6 =