First you need to get a QWebElement
with the image you want to save - if you don't have one, a good way to get it is
QWebElement el = view.page()->mainFrame()->findFirstElement("IMG[src='path/to/img'");
Assuming view
is the name of your QWebView
. Then,
QImage image(el.geometry().width(), el.geometry().height(), QImage::Format_ARGB32); QPainter painter(&image); el.render(&painter); painter.end(); image.save("path/to/img.png");
source share