void MainWindow::on_actionExtract_Image_triggered() { // imageBefore not loaded: if (imageBefore.isNull()) { QMessageBox::information(this, tr("ERROR"),tr("First you must open the image from which you want to extract.")); return; } // extract image hidden in imageBefore: Encoder encoder; imageAfter = encoder.extractImage(imageBefore); //and show it to the user showImageAfter(); }