02-14-2014 10:36 PM
JPEG image is converted into QVariant (with bb::cascades::Image) using the following code
//// m_image is bb::cascades::Image
m_image = bb::cascades::Image(imageData);
Converted to QVariant using QVariant::fromValue(m_image)
The image is displayed in qml.( I cannot save the file immedietly after downloading as there will be a lot of images and I have to select and save. When the image is displayed its QVariant..
I would like to save this image, which later to be used as Contact Photo..
I saw the sample code
//imageData1 is QByteArray
Image image = QImage::fromData(imageData1, "BMP");
QFile outFile("shared/photos/temp1.bmp"); //change to your file path
I tried to convert QVariant to QByteArray using QVariant.toByteArray(). but it didnt work.
Any help will be really appreciated..
Solved! Go to Solution.
02-24-2014 12:18 PM
The issue is resolved by keeping around ImageData data object instead of Image object. Using the following code....
QByteArray imageArray = ImageConverter::encode("image/jpeg", myImageData);
QImage image = QImage::fromData(imageArray, "JPEG");
QString imgPath = "shared/photos/"+myImageName+".jpg";