def load_image(self, image_path):
        image = Image.open(image_path)
        
        # Check if the image has EXIF data
        if "exif" in image.info:
            try:
                exif_data = piexif.load(image.info["exif"])
                if piexif.ImageIFD.Orientation in exif_data["0th"]:
                    orientation = exif_data["0th"][piexif.ImageIFD.Orientation]
                    if orientation == 3:
                        image = image.rotate(180, expand=True)
                    elif orientation == 6:
                        image = image.rotate(-90, expand=True)
                    elif orientation == 8:
                        image = image.rotate(90, expand=True)
            except ValueError as e:
                pass
            
        if self.is_greyscale:
            image = image.convert("L")
    
        if self.is_mirrored:
            image = image.transpose(Image.FLIP_LEFT_RIGHT)
        
        if self.rotated != 0:
            image = image.rotate(self.rotated, expand=True)

        aspect_ratio = image.width / image.height
        canvas_width = self.canvas.winfo_width()
        canvas_height = self.canvas.winfo_height()
        max_width = min(canvas_width, int(aspect_ratio * canvas_height))
        max_height = min(canvas_height, int(canvas_width / aspect_ratio))
        scale_factor = min(max_width / image.width, max_height / image.height)
        new_width = int(image.width * scale_factor)
        new_height = int(image.height * scale_factor)

        if new_width > 0 and new_height > 0:
            resized_image = image.resize((new_width, new_height), Image.BICUBIC)
            self.photo = ImageTk.PhotoImage(resized_image)
            self.canvas.delete("all")
            self.canvas.create_image(canvas_width // 2, canvas_height // 2, image=self.photo)

        if self.grid_type:
            self.draw_grid(self.grid_type, new_width, new_height)
        self.main_frame.lift()
        self.timer_label.lift()        
    def display_image(self): 
        if self.image_folder != "" and len(self.image_files) > 0:
            if self.update_switch_timestamps():
                # Show the text of the image name instead of loading the actual image
                image_name =  self.history[self.history_index]
                self.canvas.delete("all")  # Clear the canvas
                self.canvas.create_text(
                    self.canvas.winfo_width() // 2, 
                    self.canvas.winfo_height() // 2,
                    text=image_name,
                    fill="white"
                )
                # Schedule the image load with a delay
                if self.timer is not None:
                    self.root.after_cancel(self.timer) # Cancel existing timer to avoid conflicts
                self.timer = self.root.after(500, self.load_image_delayed) # Set a new timer to load the image after 500ms

            else:
                # Load the image normally if not quick-switching
                self.current_image_index = self.history[self.history_index]
                image_path = os.path.join(self.image_folder, self.current_image_index)
                self.path_to_open = image_path
                threading.Thread(target=self.load_image, args=(image_path,)).start()
        self.main_frame.lift()
        self.timer_label.lift()
    def update_image_size(self, event=None):
        current_width = self.root.winfo_width()
        current_height = self.root.winfo_height()
    
        if (current_width, current_height) != self.window_size:
            self.window_size = (current_width, current_height)
            self.canvas.config(width=current_width, height=current_height)
            self.buffer_forsize()
	
    def buffer_forsize(self, event=None):
        if self.resize_timer:
            self.root.after_cancel(self.resize_timer)
        self.resize_timer = self.root.after(500, self.display_image)

can i make py canvas zoom with the scroll wheel? and show a small window thumbnail showing position in zoom in the left  corner?