Is it possible to save big images without blocking Qt GUI?

I have a gui in pyqt and need to save a big image, when I try to use opencv imwrite it blocks application gui and makes it not responding, I tried to put imwrite in another thread but it didn’t do anything, is there any other method to save big images without freezing gui?

since this is a Qt problem, you should ideally ask this on a forum for Qt. it’s not a problem specific to OpenCV. any operation that takes a bit of time, if you execute it in an event handler of a GUI, will block the GUI.

then you didn’t actually put that into another thread, or you did something else that defeats the mechanism.

I already have a worker thread for calculations and time consuming operations, first I tried to save in that worker thread, but it blocked gui and made program not responding while save is being run, then I tried to add 3rd thread for just save and it made no difference compared to 2 thread approach, so you are telling its an issue related to pyqt not opencv?

the approach is correct. if you need help with that, you can’t keep the code a secret.

I would recommend discussing that on a Qt-specific forum. cv::imwrite() does not touch any Qt GUI.

Yes, I believe it’s an issue with your code and how you use Qt.

ok thanks, I’m making big images(50000*50000) and need to save images when save button is clicked, was thinking if there is another library to save big images and not freeze gui for the duration of save

if the data is ok to handle by pointer/reference, just hand it off to a worker thread/pool.

if it isn’t, make a copy in RAM, and hand that off. a copy in RAM might be quick enough to not affect GUI event processing.

again, you have shown zero code for anyone to debug, so there’s nothing anyone can do to help.

thanks for your answers, I found issue and fixed it