Initial commit
[longneck.git] / longneck.py
blob60079734cd5a00617b4a587b415e187c3ac12742
1 #!/usr/bin/python
3 import pygame
4 from optparse import OptionParser
5 from pprint import pprint
7 parser = OptionParser()
8 parser.add_option("-s", "--size",
9 dest="size",
10 type='int',
11 default=500,
12 help="internal width/height of the new image in pixels")
14 parser.add_option("-c", "--scale",
15 dest="scale",
16 type='int',
17 help="output width/height of the new image in pixels")
19 (options, args) = parser.parse_args()
21 pygame.init()
23 width = height = size = int(options.size)
24 res = (size, size)
26 head = pygame.image.load('head.png')
27 desk = pygame.image.load('desk.png')
29 pprint(res)
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)
38 start = (116,124)
39 end = (width - 200, height - 111)
40 line_width = 5
42 pygame.draw.line(target, pygame.Color('black'), start, end, line_width)
44 if options.scale:
45 out_surface = pygame.transform.smoothscale(target, (options.scale, options.scale))
46 else:
47 out_surface = target
49 pygame.image.save(out_surface, 'out.png')