(self, timestamp=0, boldfont=0, textpos=default_textpos)
Returns a PIL Image instance.

        timestamp:  0 ... no timestamp (the default)
                    1 ... simple timestamp
                    2 ... timestamp with shadow
                    3 ... timestamp with outline

        boldfont:   0 ... normal font (the default)
                    1 ... bold font

        textpos:    The position of the timestamp can be specified by a string
                    containing a combination of two characters.  One character
                    must be either t or b, the other one either l, c or r.

                    t ... top
                    b ... bottom

                    l ... left
                    c ... center
                    r ... right

                    The default value is 'bl'
Returns a PIL Image instance.
Returns a PIL Image instance .
def getImage(self, timestamp=0, boldfont=0, textpos=default_textpos):
        """Returns a PIL Image instance.

        timestamp:  0 ... no timestamp (the default)
                    1 ... simple timestamp
                    2 ... timestamp with shadow
                    3 ... timestamp with outline

        boldfont:   0 ... normal font (the default)
                    1 ... bold font

        textpos:    The position of the timestamp can be specified by a string
                    containing a combination of two characters.  One character
                    must be either t or b, the other one either l, c or r.

                    t ... top
                    b ... bottom

                    l ... left
                    c ... center
                    r ... right

                    The default value is 'bl'

        """
        if timestamp:
            #text = now()
            text = time.asctime(time.localtime(time.time()))
        buffer, width, height = self.getBuffer()
        if buffer:
            im = Image.fromstring('RGB', (width, height), buffer, 'raw', 'BGR', 0, -1)
            if timestamp:
                if boldfont:
                    self.font = self.boldfont
                else:
                    self.font = self.normalfont
                tw, th = self.font.getsize(text)
                tw -= 2
                th -= 2
                if 't' in textpos:
                    y = -1
                elif 'b' in textpos:
                    y = height - th - 2
                else:
                    raise ValueError, "textpos must contain exactly one out of 't', 'b'"
                if 'l' in textpos:
                    x = 2
                elif 'c' in textpos:
                    x = (width - tw) / 2
                elif 'r' in textpos:
                    x = (width - tw) - 2
                else:
                    raise ValueError, "textpos must contain exactly one out of 'l', 'c', 'r'"
                draw = ImageDraw.Draw(im)
                if timestamp == 2: # shadow
                    draw.text((x+1, y), text, font=self.font, fill=shadowcolor)
                    draw.text((x, y+1), text, font=self.font, fill=shadowcolor)
                    draw.text((x+1, y+1), text, font=self.font, fill=shadowcolor)
                else:
                    if timestamp >= 3: # thin border
                        draw.text((x-1, y), text, font=self.font, fill=shadowcolor)
                        draw.text((x+1, y), text, font=self.font, fill=shadowcolor)
                        draw.text((x, y-1), text, font=self.font, fill=shadowcolor)
                        draw.text((x, y+1), text, font=self.font, fill=shadowcolor)
                    if timestamp == 4: # thick border
                        draw.text((x-1, y-1), text, font=self.font, fill=shadowcolor)
                        draw.text((x+1, y-1), text, font=self.font, fill=shadowcolor)
                        draw.text((x-1, y+1), text, font=self.font, fill=shadowcolor)
                        draw.text((x+1, y+1), text, font=self.font, fill=shadowcolor)
                draw.text((x, y), text, font=self.font, fill=textcolor)
            return im
def getImage ( self , timestamp = 0 , boldfont = 0 , textpos = default_textpos ) : if timestamp : #text = now() text = time . asctime ( time . localtime ( time . time ( ) ) ) buffer , width , height = self . getBuffer ( ) if buffer : im = Image . fromstring ( 'RGB' , ( width , height ) , buffer , 'raw' , 'BGR' , 0 , - 1 ) if timestamp : if boldfont : self . font = self . boldfont else : self . font = self . normalfont tw , th = self . font . getsize ( text ) tw -= 2 th -= 2 if 't' in textpos : y = - 1 elif 'b' in textpos : y = height - th - 2 else : raise ValueError , "textpos must contain exactly one out of 't', 'b'" if 'l' in textpos : x = 2 elif 'c' in textpos : x = ( width - tw ) / 2 elif 'r' in textpos : x = ( width - tw ) - 2 else : raise ValueError , "textpos must contain exactly one out of 'l', 'c', 'r'" draw = ImageDraw . Draw ( im ) if timestamp == 2 : # shadow draw . text ( ( x + 1 , y ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x , y + 1 ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x + 1 , y + 1 ) , text , font = self . font , fill = shadowcolor ) else : if timestamp >= 3 : # thin border draw . text ( ( x - 1 , y ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x + 1 , y ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x , y - 1 ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x , y + 1 ) , text , font = self . font , fill = shadowcolor ) if timestamp == 4 : # thick border draw . text ( ( x - 1 , y - 1 ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x + 1 , y - 1 ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x - 1 , y + 1 ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x + 1 , y + 1 ) , text , font = self . font , fill = shadowcolor ) draw . text ( ( x , y ) , text , font = self . font , fill = textcolor ) return im