## 用Python Script做PS：PIL多图合并DIY桌面之纪伯伦小诗

第一次，它告诉全世界它只做自己，但它更想取悦他人。

第二次，每个无关紧要的情绪，都会被它无限放大。

第三次，它以无私之名付出，得不到回报却比谁都气恼。

第四次，它总觉得自己可以做得更好，却没有为此付出辛劳。

第五次，它看不起自己，却借此对他人嗤之以鼻。

第六次，它常回忆过去，陷入自己营造的忧伤。

第七次，它也幻想未来，困于自己假想的纷扰。

第八次，它明知自己的想法不着边际毫无意义，虽想终止，却又停不下来。

 1 import Image
3 im = list()
4 for i in range(10):
5     im.append(Image.open(root + str(i) + '.jpg'))
6 ratio = 0.0
7 for i in im:
8     x, y = i.size
9     ratio += float(y)/x
10 ratio /= len(im)
11 x, y = im[9].size
12 ratio9 = float(y)/x
13 y = 800/3
14 x = int(y/ratio)
15 a = int(1280-3*x)
16 b = int(a*ratio9)
17 im = [i.resize((x, y), Image.ANTIALIAS) for i in im]
18 im[9] = im[9].resize((a, b), Image.ANTIALIAS)
19 ims = Image.new('RGB', (1280, 800), color='white')
20 ims.paste(im[9], (0, (800-b)))
21 ims.paste(im[0], (a, 0))
22 ims.paste(im[1], (a+x, 0))
23 ims.paste(im[2], (a+x*2, 0))
24 ims.paste(im[3], (a, y))
25 ims.paste(im[4], (a+x, y))
26 ims.paste(im[5], (a+x*2, y))
27 ims.paste(im[6], (a, y*2))
28 ims.paste(im[7], (a+x, y*2))
29 ims.paste(im[8], (a+x*2, y*2))
30 ims.save(root+'sorrow.jpg')

Kahlil Gibran，1883—1931

The first time when I saw her being meek that she might attain height.

The second time when I saw her limping before the crippled.

The third time when she was given to choose between the hard and the easy,

and she chose the easy.

The fourth time when she committed a wrong,

and comforted herself that others also commit wrong.

The fifth time when she forbore for weakness, and attributed her patience to strength.

The sixth time when she despised the ugliness of a face,

and knew not that it was one of her own masks.

And the seventh time when she sang a song of praise, and deemed it a virtue.

posted on 2012-05-20 01:09  小唯THU  阅读(1287)  评论(0编辑  收藏  举报