1 #!C:\Python32\python.exe
2 """<title>a tga creator</title>
3 <pre>usage: tganew fname.tga w h
6 -h, --help show this help message and exit
9 tganew tiles.tga 256 256
13 from optparse import OptionParser
15 usage = "usage: %prog fname.tga w h"
16 parser = OptionParser(usage)
17 (opts,args) = parser.parse_args()
19 parser.error("incorrect number of arguments")
21 try: fname,w,h = args[0],int(args[1]),int(args[2])
22 except: parser.error("width and height must be integers")
23 if w < 1 or h < 1: parser.error("width and height must be greater than 0")
26 from pygame.locals import *
28 s = pygame.Surface((w,h),SWSURFACE|SRCALPHA,32)
31 pygame.image.save(s,fname)
32 # vim: set filetype=python sts=4 sw=4 noet si :