June 2019
Intermediate to advanced
348 pages
8h 28m
English
In the preceding subsection, we implemented a blur filter and successfully blurred an image with it—the blurred image was rendered on the OpenGL viewport. So, can we save that resulting image as a file on our local disk? Sure; let's do it as follows:
void GLPanel::saveOutputImage(QString path) { QImage output(img.width(), img.height(), QImage::Format_RGB888); glReadPixels( 0, 0, img.width(), img.height(), GL_RGB, GL_UNSIGNED_BYTE, output.bits()); output = output.mirrored(false, true); output.save(path); }
We add a new GLPanel::saveOutputImage method that accepts a file path as its argument to save the image. Another thing worth noting is that we change the original image, QImage img, from a local variable in the ...
Read now
Unlock full access