Advertisement
here2share

# Tk_ImageChops_RGBA.py

Sep 5th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # Tk_ImageChops_RGBA.py
  2.  
  3. from Tkinter import Tk, Canvas, Label
  4. 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, 150, 300, 440], (128,0,0))
  15. draw2.ellipse([150, 150, 440, 440], (0,0,128))
  16. draw3.ellipse([75, 10, 375, 300], (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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement