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.
|
|
|
|
"""
|
2005-09-20 09:05:05 +02:00
|
|
|
import Image,ImageOps
|
2005-09-06 19:52:46 +02:00
|
|
|
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)
|
2005-09-20 09:05:05 +02:00
|
|
|
#bg = Image.composite(img,bg,img)
|
2005-09-06 19:52:46 +02:00
|
|
|
bg.save("img/"+item+".png")
|
2005-09-20 09:05:05 +02:00
|
|
|
tmp = bg #for the white stones
|
|
|
|
tmp2 = bg #for the black stones
|
2005-09-06 19:52:46 +02:00
|
|
|
#filling with white stones
|
2005-09-20 09:05:05 +02:00
|
|
|
tmp.paste(whitestone,None,whitestone)
|
|
|
|
tmp.save("img/"+item+"_white.png")
|
2005-09-06 19:52:46 +02:00
|
|
|
#filling with black stones
|
2005-09-20 09:05:05 +02:00
|
|
|
tmp2.paste(blackstone.convert("RGB"),None,blackstone)
|
|
|
|
tmp2.save("img/"+item+"_black.png")
|