#NEWLINE# def render( self ) : #NEWLINE# #INDENT# posnew = 7 #NEWLINE# bgimg = Image . open ( settings . CAPTCHA_BASE_IMAGE ) #NEWLINE# for c in self . solution : #NEWLINE# #INDENT# fgimg = Image . new ( 'RGBA' , self . size , '#a6a6a6' ) #NEWLINE# font = ImageFont . truetype ( self . font , random . randrange ( * ( 30 , 35 ) ) ) #NEWLINE# charimg = Image . new ( 'L' , font . getsize ( ( ' %s ' % c ) ) , '#000000' ) #NEWLINE# draw = ImageDraw . Draw ( charimg ) #NEWLINE# draw . text ( ( 0 , 0 ) , ( ' %s ' % c ) , font = font , fill = '#ffffff' ) #NEWLINE# charimg = charimg . rotate ( random . randrange ( * ( ( - 30 ) , 31 ) ) , expand = 1 , resample = Image . ANTIALIAS ) #NEWLINE# charimg = charimg . crop ( charimg . getbbox ( ) ) #NEWLINE# maskimg = Image . new ( 'L' , self . size ) #NEWLINE# ypos = random . randrange ( * ( 8 , 12 ) ) #NEWLINE# maskimg . paste ( charimg , ( posnew , ypos , ( charimg . size [ 0 ] + posnew ) , ( charimg . size [ 1 ] + ypos ) ) ) #NEWLINE# bgimg = Image . composite ( fgimg , bgimg , maskimg ) #NEWLINE# posnew += ( charimg . size [ 0 ] + random . randrange ( * ( ( - 2 ) , 8 ) ) ) #NEWLINE# #UNINDENT# return bgimg