Rcjp's Weblog

September 8, 2006

Drawing on a bmp

Filed under: python — rcjp @ 4:10 pm

I needed a bit of code to draw ontop of some bitmaps of buttons…

import Image, ImageDraw

im = Image.open("button.bmp")

# draw a cross ontop

draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line((0, im.size[1], im.size[0], 0), fill=128)
del draw

im.save("button-cross.png", "PNG")

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: