How to change font size using the Python ImageDraw Library

Posted by Eldila on Stack Overflow See other posts from Stack Overflow or by Eldila
Published on 2010-04-28T00:54:29Z Indexed on 2010/04/28 1:43 UTC
Read the original article Hit count: 253

Filed under:

I am trying to change the font size using python's ImageDraw library.

You can do something like this:

fontPath = "/usr/share/fonts/dejavu-lgc/DejaVuLGCSansCondensed-Bold.ttf"
sans16  =  ImageFont.truetype ( fontPath, 16 )

im  =  Image.new ( "RGB", (200,50), "#ddd" )
draw  =  ImageDraw.Draw ( im )
draw.text ( (10,10), "Run awayyyy!", font=sans16, fill="red" )

The problem is that I don't want to specify a font. I want to use the default font and just change the size of the font. This seems to me that it should be simple, but I can't find documentation on how to do this.

© Stack Overflow or respective owner

Related posts about python