Text to Image in Python

0

Text to Image in Python

  • In this topic we learn how to write a code text to image in python.

Source Code:

#Follow @Programmerfect

from PIL import Image, ImageDraw
txt = input("Enter your string: ")
img = Image.new("RGB",(200, 30), color=(73,109,137))
d = ImageDraw.Draw(img)
d.text((10,100),txt,fill=(255,255,255))
img.save("texttoimage.png")

Output:

After this code, your image will be create where you have saved the python file.

 



Post a Comment

0Comments
Post a Comment (0)