[Qt-interest] Mix two images

Brad Hards bradh at frogmouth.net
Mon Jan 5 08:25:47 CET 2009


On Monday 05 January 2009 04:20:04 pm Ankit Agarwal wrote:
> Hi,
> I have a QPixmap and an image file (png). I need to superimpose the QPixmap
> on the image file and save it in another file. How can I achive this?
You don't say what you mean by superimpose - just block out some pixels? Alpha 
blend?

If you just want to drop the pixmap onto it, load the image to a QImage (which 
is a QPaintDevice), and use a QPainter to drawPixmap() wherever you want the 
image overridden.

Otherwise you'll have to play around a bit with the setCompositionMode.

In any case, read the documentation for QPainter and QImage, and you should be 
right.

Brad




More information about the Qt-interest-old mailing list