I get a numpy array from my hamamatsu camera and i want to show it on a canvas widget from tkinter and save it as TIFF or PNG, i use this part of code for it:
val_fin.dtype==np.uint16
val_max = np.amax(val_fin)
val_mul = int(65535/val_max)
val_fin = val_fin*val_mul
imcv2 = Image.fromarray(val_fin)
imcv2 = imcv2.convert('I;16')
altura, anchura = imcv2.size
print(altura,anchura)
path = filedialog.asksaveasfilename(title="Guardar imagen",
filetypes=[("TIFF", '.TIFF'), ("PNG", '*.png')],
defaultextension='.TIFF')
imcv2.save(path)
photo = ImageTk.PhotoImage(imcv2)
marco = tk.Canvas(root,width=anchura, height=altura)
marco.pack()
marco.create_image(10,10, image=photo, anchor='nw')
root.mainloop()
val_fin is the start array, it saves the image correctly but shows a withe image on the canvas, any idea? Thanks