'image appears on tkinter canvas briefly before being resized

I'm creating a script using tkinter having the property that when an individual runs it, a background image initially appears on a canvas embedded in the root window. I did some searching and found a way to import the image and resize it. However, when the script runs, the original image (not resized) briefly flickers on the lower left portion of the screen. I'd like to know how I can prevent this from occurring. Below is what I have so far, where root is my main window. While I found this approach online, I'm still not sure why it won't run without using global variables and where the e in resized is coming from.

canvas = Canvas(root, width=700, height=3500)
canvas.pack(fill=BOTH, expand=True)

def resize_image(e):
   global image, resized, image2
   img_path = '/Users/Desktop/my_image.png'
   image = Image.open(img_path)
   resized = image.resize((e.width, e.height), Image.ANTIALIAS)
   image2 = ImageTk.PhotoImage(resized)
   canvas.create_image(0, 0, image=image2, anchor='nw')

root.bind("<Configure>", resize_image)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source