Re: How to change size of PIL fonts?

Fredrik Lundh <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
On Tue, Oct 12, 2010 at 1:31 PM, Dévji Chhãngã <[email protected]> wrote:
> Hello Image-SIG,
> I am a newbie to PIL, I have following code
>
>     def __setFont (self, filename):
>         pilfont = ImageFont.load(filename)
>         return pilfont
>
>     def drawImage (self):
>         cg = CaptchaString(4)
>         myString = cg.getString() #Some other object to get string from
>         myFont = self.__setFont('E:\\pilfonts\\timB12.pil')
>
>         img = Image.new('RGB', (220,90), '#FFFFFF')
>
>         drawText = ImageDraw.Draw(img)
>         drawText.text((6, 0), myCaptchaString, font=myFont, fill=(255, 100,
> 25))
>
>         img.save('myFile.png', 'PNG')
>
> I don't know how to set font size so that it appear larger

The "pil" fonts are simple raster fonts that have a fixed size.  To
get more flexible font scaling, you want to use TrueType fonts
instead.

</F>
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.