Documentation for that QImage
constructor says
Warning: This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter.
so I'd suggest adding an image.fill(0)
before doing anything with the pixmap.