Posts

Showing posts from April, 2020

Write text on image , using python

Image
''' write text on image ''' from PIL import ImageDraw,ImageFont,Image #create your image (rgb, size,color) Img=Image.new('RGB',(255,255),color=(100,9,33)) #call image draw method to draw something draw=ImageDraw.Draw(Img) #use truetype font, put location of your font fontType=ImageFont.truetype('Arial_Narrow_7/arial_narrow_7.ttf',15) #text take 3 params PIL.ImageDraw.Draw.multitext_text(xy, text, fill=None or color, font=None or type, anchor=None) text='hello, members of Python 3 community\n this simple program of text on image' draw.multiline_text((1,1),text,font=fontType,fill=(0,15,57,124),align='center') Img.save('myimg.png')