Displaying full screen image flashes small image

I’m displaying a fullscreen image as follows:

    image = cv2.imread(image_path)
    # Create a fullscreen window
    cv2.namedWindow(window_name, cv2.WINDOW_NORMAL)
    cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
    # Show the image
    cv2.imshow(window_name, image)
    cv2.waitKey(2)

However I always see a small window flash up before the image occupies the full screen. Sometimes this small windows seems empty sometimes it looks to contain the image I’m displaying.

Is there a way to prevent this?

I’m running python opencv 4.12 on a Raspberry Pi 5.

you could try setting the window size.

or use a proper GUI toolkit instead of imshow.