webgo/generate_goban_images.py

26 lines
875 B
Python
Raw Normal View History

2005-09-06 19:52:46 +02:00
#!/usr/bin/python
"""
a simple script using pil to generate the goban from background, grid and stone images.
"""
import Image
gridlist = ["bottomleftline","bottomline","bottomrightline",
"centerline","hoshi","leftline","rightline",
"topleftline", "topline","toprightline"]
whitestone = Image.open("imgsource/whitestone.png").convert("RGBA")
blackstone = Image.open("imgsource/blackstone.png").convert("RGBA")
for item in gridlist:
#creating empty goban
bg = Image.open("imgsource/background.png").convert("RGBA")
img = Image.open("imgsource/"+item+".png").convert("RGBA")
bg.paste(img,None,img)
bg.save("img/"+item+".png")
tmp = bg #for the black stones
#filling with white stones
bg.paste(whitestone,None,whitestone)
bg.save("img/"+item+"_white.png")
#filling with black stones
tmp.paste(blackstone,None,blackstone)
tmp.save("img/"+item+"_black.png")