PIL - transparent ImageDraw.text()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aljosa

    #1

    PIL - transparent ImageDraw.text()

    is it possible to create transparent text (~50% transparency) on image?
    i'm using the following code to draw text on image:
    >>>
    font = ImageFont.truet ype(str(self.fo nt_family)+".tt f", 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

  • tac-tics

    #2
    Re: PIL - transparent ImageDraw.text( )

    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.truet ype(str(self.fo nt_family)+".tt f", 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
    =-)

    Comment

    Working...