0

I have displayed image on tkinter canvas. Then I can draw on it using code.

def get_x_and_y(event):
    global lasx, lasy
    lasx, lasy = event.x, event.y

def draw_smth(event):
    global lasx, lasy
    canvas.create_line((lasx, lasy, event.x, event.y), 
                      fill='red', 
                      width=2)
    lasx, lasy = event.x, event.y

canvas.bind("<Button-1>", get_x_and_y)
canvas.bind("<B1-Motion>", draw_smth)

There are images and drawings on canvas, but how to merge them together?

I am trying to save the altered image as usual.

img.save(path,quality=100)

But it doesn't work as obviously something is missing.

Please help

toyota Supra
  • 3,181
  • 4
  • 15
  • 19
z593118
  • 1
  • 1
  • Does this answer your question? [How can I convert canvas content to an image?](https://stackoverflow.com/questions/9886274/how-can-i-convert-canvas-content-to-an-image) – Marijn Apr 28 '23 at 18:02

0 Answers0