Blending two different images in Qt

My program generates 3 different images, and I would like to combine them using some opacity options.

First, I have a raw image that I have already converted to QPixmap in order to display it in QGraphicsView.

First image.

Then, with this image, I do some calculations and generate a QImage, because I need basic pixel access, I also add a legend.

Second image.

I would like to do this in order to be able to blend the two images, with the ability to change the opacity. I have no tools to show an example, it should look like this:

Third image

But with the first image and the data image mixed with opacity. I would also like the legend to remain 100% visible. I can create another QImage for the legend if necessary.

I also know for sure which pixel should be considered transparent, and not white, if it comes to it.

In the future, I would like to adjust the opacity only with the slider, so I think it would be better if there was a solution that would not include calculating the whole new image every time ...

Any guidance would be appreciated ...

+5
source share
2 answers

QGraphicsPixmapItem:: setOpacity, - 0.0... 1.0 .

pixmap , setOpacity QPainter, pixmap.

+3

QImage, - QImage:: Format_ARGB32_Premultiplied, , - QImages

, , A

0

All Articles