PDA

View Full Version : Qimage::save returns false in release



CCTeam
19th May 2010, 08:48
Hi all, I'm new to the forum!

I have a problem with QImage::save(); it works ok in debug, but when I use it in release it returns always false.
I'm using Qt 4.6; Does anybody have idea of what can be the problem?

Thank you.

high_flyer
20th May 2010, 10:34
Did you run the application directly (by running the exe) or do you run it from the IDE?

CCTeam
25th May 2010, 16:22
First of all Excuse me for the delay on the response.

I run the the application directly.

high_flyer
25th May 2010, 20:16
Hmm... can you show your code?

CCTeam
26th May 2010, 17:30
I saw that the problem occurs only with JPG and TIFF format; with BMP and PNG works fine also in release;
however the code I used is:

typedef unsigned char LMV_UC;

bool ApplicationCommands::saveScreenshot(){
QSettings settings;
QString fileName;
QString str_extention, str_extention_complete;

//***get last path from settings
QString imageSavePath = settings.value("refPathImageSave", QString(QDir::homePath())).toString();

//***this is my custom dialog to choose the file name and type of the file to save
ScreenshotDialog* CSD = new CuboScreenshotDialog();
if ( CSD->exec() ){

//***this is a method to get the image like screenshot of a custom window;
//***it creates the image in this way:
//***LMV_UC* rawImage = (LMV_UC*)calloc( sizeof( LMV_UC ), 4*extendedWidth*extendedHeight);
//*** <--fills the rawImage by reading pixel from window-->
//***image = QImage ( rawImage, extendedWidth, extendedHeight, QImage::Format_RGB32 );
QImage image;
if ( !openglView->getScreenshot(image) ){
return false;
}


//***gets the file name to save...
fileName = CSD->getFileName();

//***...and the quality
short quality = CSD->getQuality();

//***image saving...
return( image.save(fileName, 0, quality) );

}
return false;
}

Lykurg
26th May 2010, 17:35
I saw that the problem occurs only with JPG and TIFF format; with BMP and PNG works fine also in release; Then your code is fine, you only need to deploy the plugins for tiff and jpeg alongside your application!