QML canvas.save() or Item grabToImage() create a png file with transparent background
Unsolved
QML and Qt Quick
-
Hello guys,
I have a picture drawn on Qml canvas. I want to store that picture by calling canvas.save() or cavas.grabToImage() .
When I tried to save with "png" type , my image have a black background but the image generated with a transparent background like this: https://bugreports.qt.io/browse/QTBUG-44288
Saving to Jpeg or bmp is ok.Could you please help ?
Thank you!
-
@Tân-Ngọc-Đỗ Isn't it a bug then ?
-
Canvas { id: canvas anchors { fill : parent } // antialiasing: true onPaint: { var ctx = canvas.getContext("2d") ctx.fillStyle = "white" ctx.fillRect(0, 0, canvas.width, canvas.height) }
}
// Adding a fillStyle might help !!!!