confused
confused

Reputation: 1323

Python PIL using different font

I have an image I would like to add text to but I want to use both a different style font and a something bigger than the smallest thing known to mankind. Heck you can hardly read the text it's so darn small. I can print the text to the screen but I can't change the font style or the size of it as I don't know where the fonts are stored. I would think there would be more than one font/font size standardly available for use with Python/PIL. Where are they stored at? I am on a Linux.

Upvotes: 0

Views: 2062

Answers (1)

Claudiu
Claudiu

Reputation: 229361

Adapted from this answer:

image = Image.new("RGBA", (600,150), (255,255,255))
draw = ImageDraw.Draw(image)
font = ImageFont.truetype("resources/HelveticaNeueLight.ttf", fontsize)

draw.text((10, 0), txt, (0,0,0), font=font)

Looks like you can specify any .ttf file and any fontsize you want using the above modules and functions.

Upvotes: 1

Related Questions