Python Imaging Library

In the last post I made this image:

Locations of a legend

To do this quickly I used PIL. I had 10 png files named 1.png, 2.png, etc so I used the following code to load them one by one and paste them on top of each other to create the final image.

1
2
3
4
5
6
7
8
9
10
11
12
13
import Image

path = 'C:\\image\\'

a = Image.open(path+"1.png")

for i in range(2,11):

    b = Image.open(path+str(i)+".png")
    b.paste(a, (0, 0), b)
    
b.save(path+'stack.png',quality=100)