Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python3
- # A program to combine multiple images
- import os
- import random
- from PIL import Image
- print('Enter image path!')
- image=input()
- new1=Image.open(image)
- print('Enter another image path!')
- image2=input()
- new2=Image.open(image2)
- width, height = new2.size
- new3=new1.resize((width, height))
- for x in range(0, width, random.randint(2, 4)):
- for y in range(0, height, random.randint(2, 4)):
- pixel=new2.getpixel((x, y))
- new3.putpixel((x, y), pixel)
- print('Enter [path/filename.extension] to save file!')
- save=input()
- new3.save(save)
- while True:
- new1=Image.open(save)
- print('Image has been saved! Enter another image path to add or enter [exit] to exit!')
- image2=input()
- if image2=='exit':
- break
- else:
- new2=Image.open(image2)
- width, height = new2.size
- new3=new1.resize((width, height))
- for x in range(0, width, random.randint(2, 4)):
- for y in range(0, height, random.randint(2, 4)):
- pixel=new2.getpixel((x, y))
- new3.putpixel((x, y), pixel)
- new3.save(save)
Add Comment
Please, Sign In to add comment