05-13-2013 04:22 AM
I am trying save QBytearray as image format(png or jpg) using following code but after writing ,file is empty so plz suggest me solution
QFile outFile(filePath + fileName);
image = QImage::fromData(data);
image.save(&outFile, "PNG"); // or "PNG"
05-13-2013 05:19 AM
I think you can simply use, following API
bool QImage::save(const QString & fileName, const char * format = 0, int quality = -1) const
You code will be something like this,
QImage image = QImage::fromData(data);
image.save(filePath + fileName, "PNG"); // or "PNG"
I have used such code, works perfectly.