Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Save Image in XML file



  • Hi,
    I want to get image from camera and save to XML file.
    I pass "photoPreview.source (== image://camera/preview_1)" as URL of captured image to c++ class.
    I have this error:
    "Open error"
    How can I get URL of captured image by camera? (URL of photoPreview.source)

    QFile fileImg(url_image); // == > photoPreview.source (== image://camera/preview_1)
            fileImg.open(QIODevice::ReadOnly);
            QByteArray imageData = fileImg.readAll();
            QByteArray imageData_Base64 = imageData.toBase64();
            xmlWriter.writeAttribute("image",imageData_Base64);
    

  • Lifetime Qt Champion

    Hi,

    You need to use the capturedImagePath in order to get the file corresponding to your captured image.


Log in to reply