Results 1 to 3 of 3

Thread: What's faster: QPixmap-to-QImage or QImage-to-QPixmap

  1. #1
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default What's faster: QPixmap-to-QImage or QImage-to-QPixmap

    Before writing any trials I wanted to see if anyone knew which was faster.

  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: What's faster: QPixmap-to-QImage or QImage-to-QPixmap

    On Unix they are (or at least were in Qt3) both hell slow, so try to avoid both, especially for large images. On Windows this is a practically costless operation. I didn't make any tests but I think they are the same in cost as they do the same operations just the other way round.

  3. #3
    Join Date
    Jan 2006
    Location
    Cambridge, MA
    Posts
    32
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What's faster: QPixmap-to-QImage or QImage-to-QPixmap

    You want to convert between these types as little as possible becuase there is the possibility of slowness eveywhere. Its particularly bad on X11. Here is the deal.

    QPixmap is graphics memory. On X11 it resides on your XServer. On all platforms there is a the chance that the memeory could be loaded physically on your graphics card. This make QPixmap very fast to render with drawPixmap and dra eto with drawLine,Rect,Ploygon etc. This also amkes QPixmap very so to load from the disk and makes it impossible to polll for pixel colors or change individual pixel colors. If you want to keep a doublebuffer or images for display QPixmap is what you want.


    QImage resides in your process space. It MUST be converted to a QPixmap to render to the screen. All drawing commands will be done in Qt4 using a software renderer which is very slow. QImage is ideal for loading files formthe disk and performing pixel manipularions. So if you want to make a historgram QImage is what you want.

    Good Luck,
    --Justin

Similar Threads

  1. Diff between QImage, QPixmap, QPicture
    By nupul in forum Newbie
    Replies: 6
    Last Post: 30th April 2008, 02:02
  2. Replies: 7
    Last Post: 12th August 2006, 15:11
  3. QImage or QPixmap?
    By Dark_Tower in forum Qt Programming
    Replies: 9
    Last Post: 1st April 2006, 17:08

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.