initial commit

master
jaroslav 2012-09-27 17:14:46 +02:00
commit 7b15ad679c
3 changed files with 36 additions and 0 deletions

BIN
mana_ball_demon_empty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
mana_ball_demon_full.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

36
mana_chart.py Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/python
# v0.1 jaroslav@hackerspace.pl
import sys
import Image
### settings
src_img_path="./"
dst_img_path="../public_html/"
dst_img_name="result.jpg"
### end of settings
if (len(sys.argv) != 3):
print "usage: %s current target" % (sys.argv[0])
sys.exit(1)
current=float(sys.argv[1])
target=float(sys.argv[2])
img_width=108
img_height=97
h=int((current/target)*img_height)
mana_full_img=Image.open(src_img_path+"mana_ball_demon_full.png")
mana_empty_img=Image.open(src_img_path+"mana_ball_demon_empty.png")
# calculate the size of region we want to copy from full mana img
box=(0,img_height-h,img_width,img_height)
region=mana_full_img.crop(box)
mana_result_img=Image.new('RGBA',(img_width,img_height))
mana_result_img.paste(mana_empty_img)
mana_result_img.paste(region,box)
mana_result_img.save(dst_img_path+dst_img_name,"JPEG")