PDA

View Full Version : cannot save QPixmap as jpeg



arunredi
16th May 2008, 08:14
Hi,
I'm not able to save a pixmap data to jpeg format. but if I opt of png then it works. what am I missing here?

Note: I have my Qt built statically and thats when all this kind of wierd problems are showing up.

here is my code:


originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
screenshotLabel->setPixmap(originalPixmap.scaled(screenshotLabel->size(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation));
QString format = "jpeg";
QString initialPath = QDir::currentPath() + tr("/imagecapture/untitled.") + format;
QString fileName = initialPath;
if (!fileName.isEmpty())
originalPixmap.save(fileName, format.toAscii());

thanks,

wysota
16th May 2008, 08:42
You need to import a static plugin for JPEG into your program. See Q_IMPORT_PLUGIN in the docs.