4 from optparse
import OptionParser
5 from pprint
import pprint
7 parser
= OptionParser()
8 parser
.add_option("-s", "--size",
12 help="internal width/height of the new image in pixels")
14 parser
.add_option("-c", "--scale",
17 help="output width/height of the new image in pixels")
19 (options
, args
) = parser
.parse_args()
23 width
= height
= size
= int(options
.size
)
26 head
= pygame
.image
.load('head.png')
27 desk
= pygame
.image
.load('desk.png')
30 target
= pygame
.Surface(res
)
31 target
.fill(pygame
.Color('white'))
32 target
.blit(head
, head
.get_rect())
33 desk_rect
= desk
.get_rect()
34 desk_rect
.right
= width
35 desk_rect
.bottom
= height
36 target
.blit(desk
, desk_rect
)
39 end
= (width
- 200, height
- 111)
42 pygame
.draw
.line(target
, pygame
.Color('black'), start
, end
, line_width
)
45 out_surface
= pygame
.transform
.smoothscale(target
, (options
.scale
, options
.scale
))
49 pygame
.image
.save(out_surface
, 'out.png')