Yu can use QtConcurrent to move the calculation to a different thread. See https://doc.qt.io/qt-5.10/qtconcurrentrun.html - there is an example on how to modify a QImage