Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Creating text on images

Reply
Thread Tools

Creating text on images

 
 
morphex
Guest
Posts: n/a
 
      01-13-2005
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

 
Reply With Quote
 
 
 
 
Roland Heiber
Guest
Posts: n/a
 
      01-13-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=12
im.save(YOUR_NEW_IMAGE_HERE, IMAGE_TYPE)
###

HtH, Roland


 
Reply With Quote
 
 
 
 
morphex
Guest
Posts: n/a
 
      01-13-2005
Yes, something like that. I was a bit confused when it came to using
truetype fonts, but that was straightforward enough (just pass font
objects to the text method).

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling text in a Text Area or Text leo ASP General 1 12-05-2005 01:13 AM
DataList with RadioButtons + Images: How to click on the images to activate the radiobutton? Luis Esteban Valencia Muņoz ASP .Net 0 06-03-2005 03:22 PM
Track Images added to images folder and subfolders - send out email alerts ASP .Net 4 01-04-2005 10:01 PM
Tool for converting 12-bit TIFF images to 16-bit TIFF-images? Peter Frank Digital Photography 11 12-13-2004 02:41 AM
Can recover old images from SmartMedia card, but not recent images Stephen Stormont Digital Photography 9 10-20-2003 07:59 PM



Advertisments