more scripts file
[archive.git] / Apkawa / motivator.py
blob7f3d417aab088d050ae920820bf8383100916641
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
4 import sys,os
5 '''
6 #/usr/bin/sh
7 TEMPLATE='<?xml version="1.0" standalone="no"?>
8 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
9 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10 <svg width="800" height="600" version="1.1"
11 xmlns="http://www.w3.org/2000/svg"
12 xmlns:xlink="http://www.w3.org/1999/xlink">
13 <rect width="800" height="600"
14 style="fill:rgb(0,0,0);"/>
15 <rect x="99" y="49" width="602" height="402"
16 style="stroke:rgb(255,255,255);stroke-width:1;"/>
17 <image x="100" y="50" width="600px" height="400px"
18 xlink:href="%s"/>
19 <text text-anchor="middle" x="50%%" y="510"
20 font-family="Verdana" font-size="55"
21 style="fill:rgb(255,255,255);">
23 </text>
24 <text text-anchor="middle" x="50%%" y="550"
25 font-family="Verdana" font-size="30"
26 style="fill:rgb(255,255,255);">
28 </text>
29 </svg>';
30 printf "$TEMPLATE" "$1" "$2" "$3" | convert - "$4"
31 # ./generator.sh <картинка> <заголовок> <текст> <итоговая картинка.png>
32 '''
33 argv = sys.argv[1:]
34 print argv
35 _file, title, text, out = argv[0], argv[1], argv[2], argv[3]
37 template = '''<?xml version="1.0" standalone="no"?>
38 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
39 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
40 <svg width="800" height="600" version="1.1"
41 xmlns="http://www.w3.org/2000/svg"
42 xmlns:xlink="http://www.w3.org/1999/xlink">
43 <rect width="800" height="600"
44 style="fill:rgb(0,0,0);"/>
45 <rect x="99" y="49" width="602" height="402"
46 style="stroke:rgb(255,255,255);stroke-width:1;"/>
47 <image x="100" y="50" width="600px" height="400px"
48 xlink:href="%s"/>
49 <text text-anchor="middle" x="50%%" y="510"
50 font-family="Verdana" font-size="55"
51 style="fill:rgb(255,255,255);">
53 </text>
54 <text text-anchor="middle" x="50%%" y="550"
55 font-family="Verdana" font-size="30"
56 style="fill:rgb(255,255,255);">
58 </text>
59 </svg>'''%(_file,title,text)
60 print os.popen('echo "%s" | convert - %s'%(template, out)).read()