By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,547 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,547 IT Pros & Developers. It's quick & easy.

PIL - transparent ImageDraw.text()

P: n/a
is it possible to create transparent text (~50% transparency) on image?
i'm using the following code to draw text on image:
>>>
font = ImageFont.truetype(str(self.font_family)+".ttf", self.font_size)
draw = ImageDraw.Draw(img)
draw.text((10, 10), self.text, font=font,fill=(255,255,255))
<<<

url with example would be nice 8-)

Aljosa Mohorovic

Jul 19 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
aljosa wrote:
is it possible to create transparent text (~50% transparency) on image?
i'm using the following code to draw text on image:
>>
font = ImageFont.truetype(str(self.font_family)+".ttf", self.font_size)
draw = ImageDraw.Draw(img)
draw.text((10, 10), self.text, font=font,fill=(255,255,255))
<<<

url with example would be nice 8-)

Aljosa Mohorovic
Create a new image filled with transparency (either palletted or
alpha). Draw your text to that image instead. Then, paste the
transparent image onto your main image. I don't know of any examples
online, as I learned this through the sweat and pain of trial and error
=-)

Jul 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.