From b2f187c4ec16948555eeb68113dfa76133b52c8f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 12 Apr 2020 15:11:29 +1000 Subject: [PATCH] Added multiline text example [ci skip] --- docs/reference/ImageDraw.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/reference/ImageDraw.rst b/docs/reference/ImageDraw.rst index d888913c34a..3e453dd6f35 100644 --- a/docs/reference/ImageDraw.rst +++ b/docs/reference/ImageDraw.rst @@ -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