Save the image shown by QWebEngineView



  • I can open and show this image on the webview.

    smoke

    How could I get the image already captured by the web view?This image already exist in the view, there should be someway to get it without downloading the image again.

    A naive solution is QClipboard

    web_page_->triggerAction(QWebEnginePage::WebAction::Copy);
    QClipboard *clipboard = QGuiApplication::clipboard();
    QImage img = clipboard->image(QClipboard::Clipboard);
    if(!img.isNull()){
            qDebug()<<"can save image yeah:"<<img.save("smoke.jpg");
    }else{
            qDebug()<<"cannot copy to clipboard";
    }
    

    Problem of this solution is I have no way to stop another operation which could affect the contents of global clipboard, besides the image is different with the origin. Do I have a way to read the image buffer captured by the QWebEngineView(or Page?)? Thanks



  • I am scraping images, so far the images could be downloaded are around 90%(it depends), following are my guest, if I can open and download the image by web engine, those servers could have a higher chances to believe "I am a human", that is why I want to try on using web engine to download the image


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.