How to display a Numpy matrix, as a bitmap, into a Tkinter canvas?
More precisely, how to fill a PhotoImage
with content from a matrix?
photo = ImageTk.PhotoImage(...)
self.canvas.create_image(0,0,image=photo,anchor=Tkinter.NW)
How to display a Numpy matrix, as a bitmap, into a Tkinter canvas?
More precisely, how to fill a PhotoImage
with content from a matrix?
photo = ImageTk.PhotoImage(...)
self.canvas.create_image(0,0,image=photo,anchor=Tkinter.NW)
Copyright © 2021 Jogjafile Inc.
Here is working solution, slightly modified to make it work (some function was deprecated) and to simplify it to keep only the necessary part. We have to use
Image.frombytes(...)
to read the data in the numpy matrix.