November 2018
Intermediate to advanced
492 pages
12h 19m
English
We can add text to an image using the text() function from the PIL.ImageDraw module, as shown in the next Python code snippet:
draw = ImageDraw.Draw(im)font = ImageFont.truetype("arial.ttf", 23) # use a truetype fontdraw.text((10, 5), "Welcome to image processing with python", font=font)del drawim.show()
The following figure shows the output image generated by running the previous code:

Read now
Unlock full access