Results 1 to 2 of 2

Thread: cannot save QPixmap as jpeg

  1. #1
    Join Date
    Apr 2008
    Location
    California
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Unhappy cannot save QPixmap as jpeg

    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:

    Qt Code:
    1. originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
    2. screenshotLabel->setPixmap(originalPixmap.scaled(screenshotLabel->size(),
    3. Qt::KeepAspectRatio,
    4. Qt::SmoothTransformation));
    5. QString format = "jpeg";
    6. QString initialPath = QDir::currentPath() + tr("/imagecapture/untitled.") + format;
    7. QString fileName = initialPath;
    8. if (!fileName.isEmpty())
    9. originalPixmap.save(fileName, format.toAscii());
    To copy to clipboard, switch view to plain text mode 

    thanks,
    - AR

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot save QPixmap as jpeg

    You need to import a static plugin for JPEG into your program. See Q_IMPORT_PLUGIN in the docs.

Similar Threads

  1. Loading jpeg (QPixmap with Qt Jambi)
    By Mr_Blonde in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2006, 18:06
  2. Replies: 7
    Last Post: 12th August 2006, 15:11
  3. QPixmap and HBITMAP
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 16:24
  4. What does "Save All" actually save?
    By Mariane in forum Newbie
    Replies: 7
    Last Post: 31st January 2006, 13:23

Tags for this Thread

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.