Answers for "how to create image with text in python"

3

put text on image python

from PIL import Image, ImageFont, ImageDraw

my_image = Image.open("image.jpg")

title_font = ImageFont.truetype('font.ttf', 200)

image_editable = ImageDraw.Draw(my_image)
image_editable.text((15,15), "Text goes here", (237, 230, 211), font=title_font)

my_image.save("image-text.jpg")
Posted by: Guest on March-18-2021
0

image to text python

from os import closerange
from PIL import Image
import pytesseract as tess
tess.pytesseract.tessetact_cmd = r'give your PATH TO TESSETACT.EXE'

image = r'complete path to image file'
text = tess.image_to_string(Image.open(image), lang="eng")
print(text)
Posted by: Guest on August-03-2021

Code answers related to "how to create image with text in python"

Python Answers by Framework

Browse Popular Code Answers by Language