Add Text on Image using PIL

后端 未结 8 1255
后悔当初
后悔当初 2020-12-07 08:02

I have an application that loads an Image and when the user clicks it, a text area appears for this Image (using jquery), where user can write some text on the

8条回答
  •  轮回少年
    2020-12-07 08:18

    Even more minimal example (draws "Hello world!" in black and with the default font in the top-left of the image):

    ...
    from PIL import ImageDraw
    ...
    ImageDraw.Draw(
        image  # Image
    ).text(
        (0, 0),  # Coordinates
        'Hello world!',  # Text
        (0, 0, 0)  # Color
    )
    

提交回复
热议问题