Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_ImageChops.py
- from Tkinter import Tk, Canvas, Label
- from PIL import ImageDraw, ImageChops, Image, ImageTk
- image1 = Image.new("RGBA", (500, 500), color=0)
- image2 = Image.new("RGBA", (500, 500), color=0)
- image3 = Image.new("RGBA", (500, 500), color=0)
- draw1 = ImageDraw.Draw(image1)
- draw2 = ImageDraw.Draw(image2)
- draw3 = ImageDraw.Draw(image3)
- draw1.ellipse([10, 190, 300, 490], (128,0,0))
- draw2.ellipse([200, 190, 490, 490], (0,0,128))
- draw3.ellipse([100, 15, 400, 305], (0,128,0))
- out = ImageChops.add(image1,image2,0.5)
- out = ImageChops.add(out,image3,0.5)
- win2 = Tk()
- photo = ImageTk.PhotoImage(out)
- label = Label(win2, image=photo)
- label.pack()
- win2.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement