Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- def avTwo(t1, t2):
- return tuple([(a+b)/2 for a, b in [i for i in zip(t1, t2)]])
- file1 = 'a.png'
- file2 = 'b.png'
- dimensions = (1920,1080)
- pic1 = Image.open(file1).resize(dimensions)
- pic2 = Image.open(file2).resize(dimensions)
- p1dat = pic1.getdata()
- p2dat = pic2.getdata()
- p1dat = list(p1dat)
- p2dat = list(p2dat)
- total = [avTwo(a, b) for a, b in zip(p1dat, p2dat)]
- img = Image.new('RGB', dimensions, "white")
- img.putdata(total)
- img.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement