Python provides a lot of useful tools and libraries to handle images.

If you want to modify an image you can use the PIL (Python Image Library) to apply filters, draw a line, draw a rect, draw an oval, draw an image, or draw a text on the image.

In the following few lines of code I’m going to show to you how to add a copyright mark onto your own images.

The file we want to mark is the following:

original

The program is really simple and self explanatory:

We load the PIL library
We load the font we want to use (this can be different on different operating systems)
We load the image we want to modify
We draw the string onto the image
We save back the image with a different name.
After running this program the file will become as follows:

 

Screen Shot 2012-12-27 at 22.59.47

Gg1