Advertisement
here2share

# Tk_ImageChops.py

Mar 22nd, 2021
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. # Tk_ImageChops.py
  2.  
  3. from Tkinter import Tk, Canvas, Label
  4. from PIL import ImageDraw, ImageChops, Image, ImageTk
  5.  
  6. image1 = Image.new("RGBA", (500, 500), color=0)
  7. image2 = Image.new("RGBA", (500, 500), color=0)
  8. image3 = Image.new("RGBA", (500, 500), color=0)
  9.  
  10. draw1 = ImageDraw.Draw(image1)
  11. draw2 = ImageDraw.Draw(image2)
  12. draw3 = ImageDraw.Draw(image3)
  13.  
  14. draw1.ellipse([10, 190, 300, 490], (128,0,0))
  15. draw2.ellipse([200, 190, 490, 490], (0,0,128))
  16. draw3.ellipse([100, 15, 400, 305], (0,128,0))
  17.  
  18. out = ImageChops.add(image1,image2,0.5)
  19. out = ImageChops.add(out,image3,0.5)
  20.  
  21. win2 = Tk()
  22.  
  23. photo = ImageTk.PhotoImage(out)
  24.  
  25. label = Label(win2, image=photo)
  26. label.pack()
  27.  
  28. win2.mainloop()
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement