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.text() Draws the string at the given position.
Syntax:
ImageDraw.Draw.text(xy, text, fill=None, font=None, anchor=None, spacing=0, align="left")
Parameters:
xy β Top left corner of the text.
text β Text to be drawn. If it contains any newline characters, the text is passed on to multiline_text()
fill β Color to use for the text.
font β An ImageFont instance.
spacing β If the text is passed on to multiline_text(), the number of pixels between lines.
align β If the text is passed on to multiline_text(), βleftβ, βcenterβ or βrightβ.
Return Type:
returns an image with text.
Image Used:
π Image
Code : Using PIL | ImageDraw.Draw.text()
Output:
π Image
Another Example:Here we changing parameter.
Image Used:
π Image
Code : Using PIL | ImageDraw.Draw.text()