commit 7b15ad679c8ad5b184a013f3b3c137ef54d3648d Author: Jarosław Górny Date: Thu Sep 27 17:14:46 2012 +0200 initial commit diff --git a/mana_ball_demon_empty.png b/mana_ball_demon_empty.png new file mode 100644 index 0000000..2d1ecb1 Binary files /dev/null and b/mana_ball_demon_empty.png differ diff --git a/mana_ball_demon_full.png b/mana_ball_demon_full.png new file mode 100644 index 0000000..6819cdb Binary files /dev/null and b/mana_ball_demon_full.png differ diff --git a/mana_chart.py b/mana_chart.py new file mode 100755 index 0000000..97e2c33 --- /dev/null +++ b/mana_chart.py @@ -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") +