📅  最后修改于: 2022-03-11 14:46:10.855000             🧑  作者: Mango
#first install Library
!pip install pillow
#import as so
from PIL import Image, ImageFont, ImageDraw
#Code
#save image to folder or get the file path
a_image = Image.open('image that you want to edit.jpg')
#download the font you want and save to the same folder
a_font = ImageFont.truetype('Choice_of_Font.ttf',size=60)
text = 'Type the text you would like to input'
#convert image to edit
a = ImageDraw.Draw(a_image)
# First Argument is the positioning (vertical,horizontal)
# Third Argumnent is the font color in RHB use color picker to get
# the color of choice
a.text((420,390),text,(145,116,36),font=a_font)
#save it
a_image.save('image.jpg')
#open the image
a_image.show()