import Image import os import urllib2,StringIO # Open the Web site backpre = urllib2.urlopen('http://users.commspeed.net/tbabbitt//upload/IM000234.JPG') churchpre = urllib2.urlopen('http://216.19.27.24/church.jpg') church2pre = urllib2.urlopen('http://216.19.27.24/church2.jpg') # Load image into PIL object via a string useing StringIO backgroung = Image.open(StringIO.StringIO(backpre.read())) church = Image.open(StringIO.StringIO(churchpre.read())) church2 = Image.open(StringIO.StringIO(church2pre.read())) # make a directory for files #newpath = os.path.join(os.pardir,'kivotion') #if not os.path.isdir(newpath): # os.mkdir(newpath) newpath = 'c:\\python24\\tom2\\church\\' newpath2 = 'c:\\python24\\tom2\\church2\\' listfile = file(os.path.join(newpath,'church.txt'),'w') listfile2 = file(os.path.join(newpath2,'church.txt'),'w') j = 0.0 for i in range(0,1632): blankimg = Image.new('RGB',(1632,1232)) outfile = os.path.join(newpath,'church' + str(i+1) + '.gif') listfile.write('%s\n'%outfile) blankimg.paste(church,(i+1,129)) newimg_new = Image.blend(backgroung,blankimg,.33) anewimg = Image.blend(newimg_new,blankimg2,.33) newimg = Image.blend(anewimg,blankimg,.33) newimg2 = newimg.crop((i+1,129,i + church.size[0],129 + church.size[1])) try: newimg2.save(outfile) except SystemError: pass print 'pass' print str(i) + ' ', blankimg2 = Image.new('RGB',(1632,1232)) outfile2 = os.path.join(newpath2,'church' + str(int(j)+1) + '.gif') listfile2.write('%s\n'%outfile2) blankimg2.paste(church2,(802,int(j)+1)) #anewimg = Image.blend(newimg,blankimg2,.33) anewimg2 = anewimg.crop((802,int(j)+1,802 + church2.size[0],int(j) + church2.size[1])) try: anewimg2.save(outfile2) except SystemError: pass print 'pass' print str(int(j)) + '-c2- ', #j = j + 14.343137254901960784313725490196 j = j + 0.75490196078431372549019607843137 listfile.close() listfile2.close() #os.system('c:\python23\tom2\church1\whirlgif.exe -o c:\python23\tom2\church3\church.gif -loop 10 -time 50 -i c:\python23\tom2\church3\church.txt')