Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python PIL | ImageDraw.Draw.multiline_textsize()

  • Last Updated : 17 Sep, 2019

PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageDraw module provide simple 2D graphics for Image objects. You can use this module to create new images, annotate or retouch existing images, and to generate graphics on the fly for web use.

ImageDraw.Draw.multiline_textsize() Return the size of the given string, in pixels.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

ImageDraw.Draw.multiline_textsize(text, font=None, spacing=0)

text – Text to be measured.
font – An ImageFont instance.
spacing – The number of pixels between lines.

Return Type:
returns an image with text.

Image Used:

Code : Using ImageDraw.Draw.multiline_textsize

# Importing Image and ImageFont, ImageDraw module from PIL package 
from PIL import Image, ImageFont, ImageDraw 
# creating a image object 
image ='C:\Users\System-Pc\Desktop\rose.jpg'
draw = ImageDraw.Draw(image) 
#specified font size
font = ImageFont.truetype(r'C:\Users\System-Pc\Desktop\arial.ttf',30)
text =u"""\
# drawing text size
draw.text((20,18), text,font = None,spacing=0 


My Personal Notes arrow_drop_up
Recommended Articles
Page :