Results 1 to 3 of 3

Thread: image conversion speed?

  1. #1
    Join Date
    Nov 2007
    Posts
    103
    Thanks
    71
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default image conversion speed?

    I have a choice to either make a QPixmap out of a file or out of a QImage.
    Which is faster?

    Which of the below functions is faster?
    Qt Code:
    1. QPixmap QPixmap::fromImage ( const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor ) [static]
    2.  
    3. QBitmap::QBitmap ( const QString & fileName, const char * format = 0 )
    To copy to clipboard, switch view to plain text mode 

    I try to achieve the following:
    1) extract QImage and QPixmap from an image file (jpg)
    2) resize both of them to a certain size
    What is the best pipeline for doing that? Should I:
    a) first make both from the file and then resize them both, or
    b) make one of them (and which one first?), then resize it and convert into the other ??

  2. #2
    Join Date
    Nov 2007
    Posts
    103
    Thanks
    71
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: image conversion speed?

    I guess my my main question is this:
    If you had to vote, which one do you think is faster:

    Qt Code:
    1. QPixmap pic;
    2. pic=pic.load(filename);
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. QPixmap pic;
    2. QImage image;
    3. pic=pic.fromImage(image, Qt::AutoColor);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: image conversion speed?

    According to the qt-source (you could also take a look by your own), QPixmap::load() uses QImage and QPixmap::fromImage() to convert it to a QPixmap. So it should be faster to get the QPixmap from the QImage.

Similar Threads

  1. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  2. Explanation to Image Formats
    By sincnarf in forum Qt Programming
    Replies: 13
    Last Post: 6th July 2007, 17:02
  3. how i can add image in my toolbar
    By jyoti in forum Qt Tools
    Replies: 7
    Last Post: 19th December 2006, 14:39
  4. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36
  5. Question about updating an image on screen
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2006, 19:01

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.