I want to create a PNG image with transparency.
QImage image(dim, dim, QImage;;Format_ARGB32);
And I set the
qRgba(qRed, qGreen, qBlue, alpha)
But the alpha channel does not modify the transparency/opacity of the color, instead modify the intensity color (from white to color).
Thus, how can I set the transparency of the QImage (which I save on file)?
I have to use QImage, no other stuff.
How do you expect to see the transparency? Ordinary image viewers like photo viewers in Windows and Linux are painting the image on a white canvas. That's why the transparent pixels are being blended with white color. Look at the pictures below :
White background with no transparency on the circle:
The same circle with 50% opacity on white background:
The circle with transparency on a grid background:
That is why advanced image editors like Photoshop, are using such canvas as their default background.