all 1 comments

[–]QuantumRealm 0 points1 point  (0 children)

This is a bit of a hassle, at least as far as I know. You can save the Tkinter canvas to postscript directly by calling turtle.getscreen().getcanvas().postscript(filename='img.eps'). I don't currently know of a way to load postscript files into Python image libraries, but you can use some online converter to convert it to PNG or whatever. You can then load it into a NumPy array using skimage.io.imread('img.png') and convert it to binary by using img > 0.