Results 1 to 6 of 6

Thread: Qimage::save returns false in release

  1. #1
    Join Date
    May 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Qimage::save returns false in release

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qimage::save returns false in release

    Did you run the application directly (by running the exe) or do you run it from the IDE?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qimage::save returns false in release

    First of all Excuse me for the delay on the response.

    I run the the application directly.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qimage::save returns false in release

    Hmm... can you show your code?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    May 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qimage::save returns false in release

    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;
    }
    Last edited by CCTeam; 26th May 2010 at 17:35.

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Qimage::save returns false in release

    Quote Originally Posted by CCTeam View Post
    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!

Similar Threads

  1. Strange error: doc.setContent(data) returns false
    By jiveaxe in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2009, 01:38
  2. QSslSocke::supportSsl() returns false
    By oscar in forum Qt Programming
    Replies: 1
    Last Post: 9th September 2008, 18:51
  3. QSqlQuery::isValid returns false
    By mismael85 in forum Qt Programming
    Replies: 24
    Last Post: 7th September 2008, 23:43
  4. Replies: 0
    Last Post: 29th July 2008, 08:08
  5. connect returns false
    By krivenok in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2006, 20:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.