Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Set image for qml camera from c++
neda last edited by neda
I convert image of camera to base64 string.
QFile fileImg(url of image); // == camera.imageCapture.capturedImagePath fileImg.open(QIODevice::ReadOnly); QByteArray imageData = fileImg.readAll(); QByteArray imageData_Base64 = imageData.toBase64(); xmlWriter.writeAttribute("image",imageData_Base64);
I have a string like this:
Now I want show above string as image in qml camera.
Please guide me.
Do you mean you would like to show the preview of the image you captured ?
neda last edited by
Thank you, my problem solved by adding "data:image/png;base64" to the beginning of encode image.