Results 1 to 7 of 7

Thread: Diff between QImage, QPixmap, QPicture

  1. #1
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Diff between QImage, QPixmap, QPicture

    Well I sort of don't understand the difference between QImage, QPixmap, and Qpicture...could any one please help me out here....

    Request: Be as clear as possible, as it's v.important for me to understand this concept.

    Thanks

    Nupul

  2. #2
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Diff between QImage, QPixmap, QPicture

    Hi..

    Did you try these docs out:

    QPixmap URL

    QImage URL

    QPicture URL

  3. The following user says thank you to Kapil for this useful post:

    TheIndependentAquarius (30th October 2013)

  4. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Red face Re: Diff between QImage, QPixmap, QPicture

    Sorry for not mentioning it before YES, I did try the docs out.....I just want someone to throw more light on the concept....still a bit dicey after reading the docs...

    Nupul

  5. #4
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Diff between QImage, QPixmap, QPicture

    QPicture: The QPicture class is a paint device that records and replays QPainter commands. It helps you create a picture of the whatever you are painting on the Painter.. You can save your painting and can reuse it... An example on the doc about QPicture explains you the same properly on how to do it...

    Though the use of QImage and QPixmap i have found pretty similar but the difference lies in pixel access and manipulation... QImage is designed and optimized for I/O, and for direct pixel access and manipulation whereas while QPixmap is designed and optimized for showing images on screen.

    The functions for the same explain you properly... just go thru them.. you can convert a QPixmap to QImage and use it functionality...

    Just try to go thru each of the functions which would help you build on the understanding pretty well..

  6. The following user says thank you to Kapil for this useful post:

    TheIndependentAquarius (30th October 2013)

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

    Default Re: Diff between QImage, QPixmap, QPicture

    QPixmap is stored on the XServer when using X11 backend, whereas QImage is just an "array in memory" of the client program. So drawing QPixmaps on XWindow systems should be much faster than drawing QImages, as the data is already on the server, processed and ready to use.

    From the programmer's point of view, treat QImage as an array of pixels and QPixmap as a "picture object" whose pixel contents are of no interest to you.

  8. The following 3 users say thank you to wysota for this useful post:

    Kapil (3rd April 2006), Mookie (16th August 2010), TheIndependentAquarius (30th October 2013)

  9. #6
    Join Date
    Apr 2008
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Re: Diff between QImage, QPixmap, QPicture

    The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.

    Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen. QBitmap is only a convenience class that inherits QPixmap, ensuring a depth of 1. Finally, the QPicture class is a paint device that records and replays QPainter commands.

  10. The following user says thank you to dadvir for this useful post:

    Goddard (26th January 2015)

  11. #7
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Diff between QImage, QPixmap, QPicture

    QImage: Fast to draw to, slow to display.
    QPixmap: Slow to draw to, fast to display.

    If you want to draw or manipulate an image, then QImage is the class for you. But if you just want to draw an existing image over and over (icon, background pixmap, OpenGL texture, etc) then use QPixmap. You can convert one to the other easily, but it is a slow operation.

    QPicture stores QPainter drawing commands, and is a completely different kind of class.

  12. The following 3 users say thank you to Brandybuck for this useful post:

    Mookie (16th August 2010), Raccoon29 (30th April 2008), TheIndependentAquarius (30th October 2013)

Similar Threads

  1. drawing on a QPixmap or QImage
    By gren15 in forum Newbie
    Replies: 15
    Last Post: 3rd March 2009, 17:48
  2. Construct QPixmap or QImage from raw data.
    By The Storm in forum Qt Programming
    Replies: 5
    Last Post: 1st December 2008, 08:21
  3. DIB to QImage or QPixmap
    By ^NyAw^ in forum Qt Programming
    Replies: 0
    Last Post: 8th August 2008, 20:18
  4. Drawing speed: QPixmap vs QPicture
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 19:17
  5. 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.