Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

relevant docs

from PIL import ImageFont, ImageDraw, Image

with Image.open("hopper.jpg") as image:
    draw = ImageDraw.Draw(image)
    
    # use a bitmap font
    font = ImageFont.load("arial.pil")
    
    draw.text((10, 10), "hello", font=font)
    
    # use a truetype font
    font = ImageFont.truetype("arial.ttf", 15)
    
    draw.text((10, 25), "world", font=font)