You should look at the PIL for such things :)
http://www.pythonware.com/products/pil/
This may be the simplest way to do what you wan.
Here is a tutorial that will give the code :
http://effbot.org/imagingbook/introduction.htm
(see chapter geometric transforms in the tutorial)