View Full Version : QImage (..) & QImage::save() always return NULL value - why?

13th March 2006, 11:09
Hi, I'm having the following problem:

I'm creating an object
QImage image ( 10,10,32 );
And tring to save it

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. :confused:
Thanks a lot for your time.

13th March 2006, 15:41
Did you try "JPEG" instead of "JPG"? Was your Qt built with JPEG support? What does QImageIO::outputFormats() return?

13th March 2006, 15:59
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. :o

Thanks a lot for your help!

15th March 2006, 12:44
Vladimir Ostapenko has told me a solution, so I'm posting a working code:

QImage image(20,20,32);
QString str = "t.jpg";

Anybody knows , why QString is necessary ?