Guest User

Untitled

a guest
Mar 10th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. #! /usr/bin/python3
  2.  
  3. # A program to combine multiple images
  4.  
  5. import os
  6. import random
  7. from PIL import Image
  8.  
  9. print('Enter image path!')
  10. image=input()
  11.  
  12. new1=Image.open(image)
  13.  
  14. print('Enter another image path!')
  15. image2=input()
  16. new2=Image.open(image2)
  17.  
  18. width, height = new2.size
  19.  
  20. new3=new1.resize((width, height))
  21.  
  22. for x in range(0, width, random.randint(2, 4)):
  23.     for y in range(0, height, random.randint(2, 4)):
  24.         pixel=new2.getpixel((x, y))
  25.         new3.putpixel((x, y), pixel)
  26.  
  27. print('Enter [path/filename.extension] to save file!')
  28. save=input()
  29. new3.save(save)
  30.  
  31. while True:
  32.     new1=Image.open(save)
  33.  
  34.     print('Image has been saved! Enter another image path to add or enter [exit] to exit!')
  35.     image2=input()
  36.  
  37.     if image2=='exit':
  38.         break
  39.    
  40.     else:
  41.         new2=Image.open(image2)
  42.  
  43.         width, height = new2.size
  44.  
  45.         new3=new1.resize((width, height))
  46.  
  47.         for x in range(0, width, random.randint(2, 4)):
  48.             for y in range(0, height, random.randint(2, 4)):
  49.                 pixel=new2.getpixel((x, y))
  50.                 new3.putpixel((x, y), pixel)
  51.  
  52.         new3.save(save)
Add Comment
Please, Sign In to add comment