Results 1 to 4 of 4

Thread: QImage (..) & QImage::save() always return NULL value - why?

  1. #1
    Join Date
    Mar 2006
    Posts
    3
    Qt products
    Qt3
    Platforms
    Windows

    Question QImage (..) & QImage::save() always return NULL value - why?

    Hi, I'm having the following problem:

    I'm creating an object
    Qt Code:
    1. QImage image ( 10,10,32 );
    To copy to clipboard, switch view to plain text mode 
    And tring to save it
    Qt Code:
    1. image.save("smth.jpg","JPG");
    To copy to clipboard, switch view to plain text mode 

    image.save returns NULL - why?

    Save function works for images being loaded and doesn't for those I create myself
    My operating system is winXP, QT ver 3.3.3, VS.NET 2003...

    Sorry if this question is too simple to be posted... still I cant find a solution.
    Thanks a lot for your time.
    GREG.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage (..) & QImage::save() always return NULL value - why?

    Did you try "JPEG" instead of "JPG"? Was your Qt built with JPEG support? What does QImageIO::outputFormats() return?

  3. #3
    Join Date
    Mar 2006
    Posts
    3
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QImage (..) & QImage::save() always return NULL value - why?

    Did you try "JPEG" instead of "JPG"?
    Tried to - no difference...
    Was your Qt built with JPEG support?
    Yes, sure - Loaded images are saved without any troubles.
    What does QImageIO :: outputFormats() return?
    Never tried it... I will tomorrow - Don't have a QT installed here to try your advises. If you have a working example consisting of creation and saving an QImage object , pls, post it here.

    Thanks a lot for your help!
    Last edited by whitesail; 13th March 2006 at 17:51.

  4. #4
    Join Date
    Mar 2006
    Posts
    3
    Qt products
    Qt3
    Platforms
    Windows

    Thumbs up Re: QImage (..) & QImage::save() always return NULL value - why?

    Vladimir Ostapenko has told me a solution, so I'm posting a working code:
    Qt Code:
    1. QImage image(20,20,32);
    2. QString str = "t.jpg";
    3. image.save(str,"JPEG");
    To copy to clipboard, switch view to plain text mode 
    Anybody knows , why QString is necessary ?

Similar Threads

  1. [SOLVED] DirectShow Video Player Inside Qt
    By ToddAtWSU in forum Qt Programming
    Replies: 16
    Last Post: 3rd November 2011, 08:47
  2. error with QList with a class
    By john_god in forum Newbie
    Replies: 7
    Last Post: 12th January 2009, 22:48
  3. QTableView performances
    By miraks in forum Qt Programming
    Replies: 18
    Last Post: 1st December 2008, 11:25
  4. QShared
    By sabeesh in forum Qt Programming
    Replies: 11
    Last Post: 11th October 2007, 13:40
  5. Problem at time compilation in traslation of language
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 15:18

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.