Set image for qml camera from c++
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 ?
Thank you, my problem solved by adding "data:image/png;base64" to the beginning of encode image.