I'm newbie on python. I found code on web but I couln't get how alignment system working. It takes names from csv and write it to jpg seperately. But long names goes out of screen and short names not center of screen. I want to fit on center. Sorry for my bad English. Thanks with my regards.
This is codes:
from PIL import Image, ImageDraw, ImageFont
import pandas as pd
import os
df = pd.read_csv('liste.csv')
font = ImageFont.truetype('font.ttf',90)
for index,j in df.iterrows():
img = Image.open('sertifika.jpg')
draw = ImageDraw.Draw(img)
text_color = (17, 72, 81)
draw.text(xy=(725,450),text='{}'.format(j['name']),fill=(0,0,0),font=font)
img.save('sertifika/{}.jpg'.format(j['name']))