I'm writing a program that makes a png file by combining two other png files.
It's joining them together but not quite the way I want it to. It joins drawing 'A' (which is a transperancy) and places it on drawing 'B'. The end result is drawing 'C' which is not what I want. I want it to look like drawing 'D'.
http://content.screencast.com/users/dchr...70/bug.png
Which drawings to merge together are specified on bres config bargraph.csv lines 5 and 16. The x and y coordinates of where to place image A onto image B is specified on lines 18 and 19
The filename of what to call this new drawing is specified on line 6
Bres data.csv is for future use. Ignore it
My code
import csv
import sys
from PIL import Image, ImageDraw, ImageFont # COMMNAD FOR INSTALL PIL sudo apt-get install python-dev libjpeg-dev libfreetype6-dev zlib1g-dev
# $ sudo pip install pil
data =
#read data file.
dataf = None
configf = None
try:
dataf = open('bres data.csv', 'rt')
configf = open('bres config bargraph.csv', 'rt')
data = [d for d in csv.reader(dataf)]
all_config = [c for c in csv.reader(configf)]
image = Image.open(all_config[5][0])
width, height = image.size
image.paste(Image.open(all_config[16][0]), (int(all_config[18][0]),int(all_config[19][0])))
image.save(all_config[6][0])
print "%s file ready"%all_config[6][0]
except Exception, e:
print "Error Encountered: ",e
finally:
if dataf:
dataf.close()
if configf:
configf.close()
It's joining them together but not quite the way I want it to. It joins drawing 'A' (which is a transperancy) and places it on drawing 'B'. The end result is drawing 'C' which is not what I want. I want it to look like drawing 'D'.

http://content.screencast.com/users/dchr...70/bug.png
Which drawings to merge together are specified on bres config bargraph.csv lines 5 and 16. The x and y coordinates of where to place image A onto image B is specified on lines 18 and 19
The filename of what to call this new drawing is specified on line 6
Bres data.csv is for future use. Ignore it
My code
import csv
import sys
from PIL import Image, ImageDraw, ImageFont # COMMNAD FOR INSTALL PIL sudo apt-get install python-dev libjpeg-dev libfreetype6-dev zlib1g-dev
# $ sudo pip install pil
data =
#read data file.
dataf = None
configf = None
try:
dataf = open('bres data.csv', 'rt')
configf = open('bres config bargraph.csv', 'rt')
data = [d for d in csv.reader(dataf)]
all_config = [c for c in csv.reader(configf)]
image = Image.open(all_config[5][0])
width, height = image.size
image.paste(Image.open(all_config[16][0]), (int(all_config[18][0]),int(all_config[19][0])))
image.save(all_config[6][0])
print "%s file ready"%all_config[6][0]
except Exception, e:
print "Error Encountered: ",e
finally:
if dataf:
dataf.close()
if configf:
configf.close()