From pil import image, imagedraw, imagefont # define image size and background color image_width = 500 image_height = 200 background_color = (255, 255, 255) # white # define text settings text = "inspire-toi" text_color = (0, 0, 0) # black text_size = 80 text_font = "arial.ttf" # path to your desired font file # create a new image with the defined size and background color image = image.new("rgb", (image_width, image_height), background_color) # create a drawing object draw = imagedraw.draw(image) # load the specified font font = imagefont.truetype(text_font, text_size) # calculate the position to center the text on the image text_width, text_height = draw.textsize(text, font=font) text_x = (image_width - text_width) // 2 text_y = (image_height - text_height) // 2 # draw the text on the image draw.text((text_x, text_y), text, font=font, fill=text_color) # save the image image.save("inspire-toi.png")