PDA

View Full Version : image conversion speed?



tommy
29th January 2008, 14:37
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?


QPixmap QPixmap::fromImage ( const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor ) [static]

QBitmap::QBitmap ( const QString & fileName, const char * format = 0 )


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 ??

tommy
29th January 2008, 23:21
I guess my my main question is this:
If you had to vote, which one do you think is faster:



QPixmap pic;
pic=pic.load(filename);

or


QPixmap pic;
QImage image;
pic=pic.fromImage(image, Qt::AutoColor);

ChristianEhrlicher
30th January 2008, 06:49
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.