[Interest] Convertion between QImage to QPixmap taking to much time.

Allan Sandfeld Jensen kde at carewolf.com
Sun Oct 18 01:37:57 CEST 2015


On Saturday 17 October 2015, Celal SAVUR wrote:
> Hello everyone,
> 
> I have some performance issue when I am using QPixmap.
> 
> I am getting image from buffer and I create QImage. After that using
> QPixmap::fromImage(), creating pixmap  and set it to QGraphicPixmapItem to
> be drawn in scene.
> 
> When I put the timer to see how much time Qt spending to create QPixmap, I
> realize that I converting  from Qimage to QPixmap taking ~20 times more
> time than crating Qimage from buffer.
> 
> By the way, I am getting image approximately every 200 ms some times faster
> than that.
> 
> Do you have any suggestion to increase the performance?
> 
You can convert a QImage into a QPixmap without image conversion by using the 
flag Qt::NoImageConversion on QPixmap::fromImage. Note though that this means 
the image will not be converted to an efficient type for painting to (which 
pixmaps normally would be), but if you are only painting from it a few times 
it might be more efficient overall.

`Allan



More information about the Interest mailing list