Originally Posted by
d_stranz
Try using something like "PNG" as the second parameter.
Thanks a lot. That solved the issue but now I am facing another issue.
After saving the image file in PNG format, I am trying to read the same file in another application and again save it in another name. (Extremely sorry if it sounds strange but please bear with me ) It's crashing.
The first app-
QImage img
= pix.
toImage();
//Converting to QImage so that I can know which format it is in.
qDebug()<<"size: "<<img.size();
qDebug()<<"format: "<<img.format(); //returns QImage::Format_RGB16
img.save("/pefis/bin/test.png", "PNG"); //This works fine
QPixmap pix = QPixmap::grabWindow(QApplication::desktop()->winId());
QImage img = pix.toImage(); //Converting to QImage so that I can know which format it is in.
qDebug()<<"size: "<<img.size();
qDebug()<<"format: "<<img.format(); //returns QImage::Format_RGB16
img.save("/pefis/bin/test.png", "PNG"); //This works fine
To copy to clipboard, switch view to plain text mode
In another app-
QImage img
("/pefis/bin/test.png",
"PNG");
qDebug()<<"size: "<<img.size();
qDebug()<<"format: "<<img.format(); //returns QImage::Format_RGB32
img.save("/pefis/bin/test1.png", "PNG"); //Crashes here. Gives SEGV Error
QImage img("/pefis/bin/test.png", "PNG");
qDebug()<<"size: "<<img.size();
qDebug()<<"format: "<<img.format(); //returns QImage::Format_RGB32
img.save("/pefis/bin/test1.png", "PNG"); //Crashes here. Gives SEGV Error
To copy to clipboard, switch view to plain text mode
First the Image format is automatically changing and then it is crashing when I am trying to save it in another name.
Please point out what mistake I am committing.
-Thanking You,
sattu
Bookmarks