Merge pull request #4548 from radarhere/multiline_text

Added multiline text example
This commit is contained in:
Hugo van Kemenade 2020-04-12 09:29:54 +03:00 committed by GitHub
commit 97280a045c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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