Hello,
I would like to save the drawings I have made on a Canvas with the Tkinter Module.
Is it possible to make a .jpg or .gif or .bmp from a Tkinter window ?
Thank you!
Hello,
I would like to save the drawings I have made on a Canvas with the Tkinter Module.
Is it possible to make a .jpg or .gif or .bmp from a Tkinter window ?
Thank you!
Ok i've found the response on www.developpez.net
It uses the .postscript method from canvas and the ImageGrab module
Bonjour,
Il y a la méthode '.postscript', qui génère ... du postscript.
Sous MS windows, tu peux utiliser ImageGrab (PIL). Je ne crois pas que cela fonctionne sous Linux.
x = canvas.winfo_rootx()
y = canvas.winfo_rooty()
w = canvas.winfo_width()
h = canvas.winfo_height()
img= ImageGrab.grab((x+2, y+2, x+w-2, y+h-2)).save("tmp.bmp")
It would be simple to use the capture option that comes with many image viewers like XnView (nice and free).
For another potential solution look at:
http://www.daniweb.com/code/snippet705.html
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.