You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
762 B
Python

from PIL import Image
base = Image.open("split/page2.png")
#rescaling the logo
basewidth = (base.size[0])
baseheight = (base.size[1])
finalpage = Image.open("pages.png")
wpercent = (basewidth/float(finalpage.size[0]))
hsize = int((float(finalpage.size[1])*float(wpercent)))
finalpage = finalpage.resize((basewidth,hsize), Image.ANTIALIAS)
finalpage.save("page_rescale.png")
foreground = Image.open("page_rescale.png")
foregroundheight = (foreground.size[1])
i = 2
while True:
try:
background = Image.open("split/page%i.png"%i)
background.paste(foreground, (0, (baseheight-foregroundheight)), foreground.convert('RGBA'))
background.save("split/page%i.png"%i)
i+=1
except:
print("DID MY JOB!")
break