Results 1 to 3 of 3

Thread: ImageViewer: Pixmap or OpenGL - performance when creating pixmap

  1. #1
    Join Date
    Jan 2020
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default ImageViewer: Pixmap or OpenGL - performance when creating pixmap

    Hello,

    I started to code my own image viewer in PyQt5 since no other image viewer I know of does work like I want it to. From the beginnings of using a Lable to now using QGraphicsView with QImage/QPixmap I wonder if it might make sense to go to openGL to display images.

    The reason I ask is, that I measure how long it takes for Qt to create a pixmap out of an image, and it seems that this really is an enourmous bottleneck as it will take like 600 ms for some 6000x8000 px image thus slowing the program down a lot compared to for example IrfanView.
    The time it takes is not because of HDD speed, as it's roughly the same when feeding it directly from a QBuffer (I read images from archives to a QBuffer and then feed it to QImage).

    So before I dive into openGL I'd like to know if openGL would speed up getting an image shown compared to QPixmaps?

    Thank you

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,317
    Thanks
    244
    Thanked 678 Times in 668 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: ImageViewer: Pixmap or OpenGL - performance when creating pixmap

    I measure how long it takes for Qt to create a pixmap out of an image
    This is the crucial piece of missing information: How exactly -are- you creating the image? Setting it pixel-by-pixel? If so, of course that will be slow. It will be no faster in OpenGL if you use the same approach.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jan 2020
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: ImageViewer: Pixmap or OpenGL - performance when creating pixmap

    Quote Originally Posted by d_stranz View Post
    This is the crucial piece of missing information: How exactly -are- you creating the image? Setting it pixel-by-pixel? If so, of course that will be slow. It will be no faster in OpenGL if you use the same approach.
    QPixmap(filepath) or QPixmap.fromImageReader() if I use a buffer.

    I found some code pieces that use "QImage tex = QGLWidget::convertToGLFormat(image);" which definitely would not help as creating a QImage is as slow as creating the QPixmap.

Similar Threads

  1. Replies: 1
    Last Post: 16th December 2019, 18:31
  2. Replies: 1
    Last Post: 19th April 2011, 12:17
  3. Creating a Pixmap for drag and drop
    By Cruz in forum Qt Programming
    Replies: 22
    Last Post: 20th January 2009, 15:51
  4. Creating a pixmap
    By maverick_pol in forum Qt Programming
    Replies: 10
    Last Post: 8th October 2008, 20:27
  5. Performance problems with small pixmap
    By RThaden in forum Qt Programming
    Replies: 4
    Last Post: 9th July 2008, 16:14

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.