[Image-SIG] changing font and size in draw.text(position, string, options)

Brian Riordan Brian.Riordan at dnr.state.mn.us
Fri Jul 13 15:02:45 CEST 2007

Hello group -

Quick background since this is my first post to this list.  I work as a GIS analyst in the US.  I have been programing with python for about 1 week now and have made some progress. However, I struggling to figure out the options for:
draw.text(position, string, options)
draw.textsize(string, options) => (width, height)
I need to place a set of text in the upper corner of around 2000 files and need to be able to adjust the text size.  I have figured out how to right the text just not how to set the text size and font type.  ANy help would be appreciated.


Current CODE:
img_list = ['C_dining_June_07.jpg']

for img in img_list:

    name = img
# Open file
    im = Image.open(img)
# set Draw
    draw = ImageDraw.Draw(im)
# Crop and Save File
    draw.textsize(12,12).text((0, 0), "THIS IS THE TEST")
    im.save(name[0:8] + "_draw.jpg")

Brian Riordan
GIS/Remote Sensing Image Analyst
Minnesota Department of Natural Resources 
Resource Assessment Division 
Grand Rapids, MN 
(218) 327-4449 x233
brian.riordan at dnr.state.mn.us

More information about the Image-SIG mailing list