Skip to content

Commit

Permalink
Merge pull request #4548 from radarhere/multiline_text
Browse files Browse the repository at this point in the history
Added multiline text example
  • Loading branch information
hugovk authored Apr 12, 2020
2 parents 27e8592 + b2f187c commit 97280a0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/reference/ImageDraw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ Example: Draw Partial Opacity Text
out.show()
Example: Draw Multiline Text
----------------------------

.. code-block:: python
from PIL import Image, ImageDraw, ImageFont
# create an image
out = Image.new("RGB", (150, 100), (255, 255, 255))
# get a font
fnt = ImageFont.truetype("Pillow/Tests/fonts/FreeMono.ttf", 40)
# get a drawing context
d = ImageDraw.Draw(out)
# draw multiline text
d.multiline_text((10,10), "Hello\nWorld", font=fnt, fill=(0, 0, 0))
out.show()
Functions
Expand Down

0 comments on commit 97280a0

Please sign in to comment.