Creating text on images

Roland Heiber roland.heiber at web.de
Thu Jan 13 07:41:12 EST 2005


morphex wrote:
> Hi all,
> 
> I'm trying to create a script that will superimpose text on an image.
> I didn't find any great examples out there on how this can be done (I
> presume using PIL is necessary), do you know of any examples?
> Thanks,
> 
> Morten
> 

Hi,

something like this?

###
from PIL import Image, ImageFont, ImageDraw
import sys

im = Image.open(YOUR_IMAGE_HERE)
idraw = ImageDraw.Draw(im)
idraw.text((1,1),"Hello", fill=128)
im.save(YOUR_NEW_IMAGE_HERE, IMAGE_TYPE)
###

HtH, Roland





More information about the Python-list mailing list