I am setting up a program to write some numbers on an image. The font size will change based on where it's writing (this size will be hardcoded).
After reading the docs, i am using ImageFont.truetype('font.ttf', fontSize) to load my font, with fontSize = 400.
from PIL import Image, ImageDraw, ImageFont
image = Image.open('base.jpg')
draw = ImageDraw.Draw(image);
fontSize = 400
font = ImageFont.truetype('font.ttf', fontSize)
color = 'rgb(0, 0, 0)'
def drawInfo():
draw.text((50, 200), '20', fill=color, font=font)
image.save('newVersion.jpg')
drawInfo()
Font: https://fonts.google.com/specimen/Kalam?selection.family=Kalam
base.jpg : https://ibb.co/6XQbxHv
newVersion.jpg : https://ibb.co/7XFRTyg
The expected result would be that the little 20 in the top left corner under strength will be huge (with the font size being 400). Unfortunately, it seems to just be the default size. What am I doing wrong?


