]> git.donarmstrong.com Git - lilypond.git/blob - scripts/build/genicon.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / build / genicon.py
1 #!@PYTHON@
2 import os
3 import sys
4 import tempfile
5
6 base = os.path.splitext (os.path.split (sys.argv[1])[1])[0]
7 input = os.path.abspath (sys.argv[1])
8 output = os.path.abspath (sys.argv[2])
9 program_name= os.path.split (sys.argv[0])[1]
10
11 dir = tempfile.mktemp (program_name)
12 os.mkdir (dir, 0777)
13 os.chdir(dir)
14
15 def system (c):
16     print c
17     if os.system (c):
18         raise Exception('The command exited with nonzero exit status!')
19
20 outputs = []
21 for sz in [48,32,16] :
22     
23     for depth in [24,8]:
24         out = '%(base)s-%(sz)d-%(depth)d.png' % locals()
25         system ('convert -depth %(depth)d -sample %(sz)d %(input)s %(out)s' %
26             locals ())
27         outputs.append (out)
28         
29 system('icotool --output %s --create %s' % (output, ' '.join (outputs)))
30 system('rm -rf %(dir)s' % locals())                 
31