PDA

View Full Version : QImage : trouble with save() method



krivenok
3rd May 2006, 13:57
Hello All!

Consider the following simple code example
//////////////////////////////////////////////////////////////////////
#include<QtGui>

int main(int argc, char** argv)
{
QImage img("1.png","png");
assert(img.save("1.jpg","jpg")); // BOOM
//assert(img.save("1.jpeg","jpeg")); // BOOM
//assert(img.save("2.png","png")); // Works fine
}
//////////////////////////////////////////////////////////////////////

Can I save my image as JPEG???

P.S.
QT-4.0.1
MinGW gcc-3.4

zlatko
3rd May 2006, 14:03
JPEG is comercial format you havent support it in free windows version of qt library

jacek
3rd May 2006, 14:24
Can I save my image as JPEG???
Make sure you have compiled Qt with JPEG support (configure -qt-libjpeg or configure -system-libjpeg). There should be qjpeg1.dll and libqjpeg1.a in %QTDIR%\plugins\imageformats.


JPEG is comercial format you havent support it in free windows version of qt library
What makes you think so?

krivenok
3rd May 2006, 14:38
My %QTDIR%\plugins\imageformats
-rw-r--r-- 1 krivenok Administ 2150 Feb 21 22:05 libqjpeg1.a
-rw-r--r-- 1 krivenok Administ 2160 Feb 21 22:05 libqjpegd1.a
-rw-r--r-- 1 krivenok Administ 2146 Feb 21 22:06 libqmng1.a
-rw-r--r-- 1 krivenok Administ 2150 Feb 21 22:05 libqmngd1.a
-rwxr-xr-x 1 krivenok Administ 152576 Feb 21 22:05 qjpeg1.dll
-rwxr-xr-x 1 krivenok Administ 924773 Feb 21 22:05 qjpegd1.dll
-rwxr-xr-x 1 krivenok Administ 311808 Feb 21 22:06 qmng1.dll
-rwxr-xr-x 1 krivenok Administ 1385962 Feb 21 22:05 qmngd1.dll

jacek
3rd May 2006, 14:55
What does QImageWriter::supportedImageFormats() return?

krivenok
3rd May 2006, 15:05
It returns:
bmp
png
ppm
xbm
xpm

krivenok
3rd May 2006, 15:07
Maybe JPEG plugin is unavailable?

zlatko
3rd May 2006, 15:24
What makes you think so?
It was in interesing arhive for qt3 windows non comercial

http://lists.trolltech.com/qt-interest/2001-07/thread00008-0.html

krivenok
3rd May 2006, 15:31
Date of message : Sun, 1 Jul 2001 :)

zlatko
3rd May 2006, 15:37
Date of message : Sun, 1 Jul 2001 :)

Yes but i dont think that licensed policy changed frequently :rolleyes:

ps. it just IMHO...i actually never try use win free version :)

jacek
3rd May 2006, 17:27
It returns:
bmp
png
ppm
xbm
xpm
Strange, I have Qt 4.1.2 and this list also includes "jpeg" and "jpg". Try to copy that qjpeg1.dll to a "imageformats" subdirectory in the directory where your executable is.

krivenok
3rd May 2006, 17:39
Strange, I have Qt 4.1.2 and this list also includes "jpeg" and "jpg". Try to copy that qjpeg1.dll to a "imageformats" subdirectory in the directory where your executable is.

No effect :(

jacek
3rd May 2006, 20:55
No effect :(
For some reason it doesn't like that plugin. How did you install Qt?