3

I am using a QImage of the format _ARGB32. I have to set some of the pixels as transparent and some as opaque. So, I used this line:

Image.setPixel(x,y,QColor(r,g,b,0).rgba());

to set the pixel as transparent. I have even tried this:

Image.setPixel(x,y,qRgba(r,g,b,0));

Still nothing happens.Just after setting it, when i print the pixel again, using:

qDebug() << "Color : " << QColor::fromRgba(Image.pixel(x,y));

I always get the value as 1 for the alpha channel. Even when i save the image, I got not get the transparency. How do I fix it?

kenzo450D
  • 51
  • 3
  • 5

1 Answers1

3

Make sure the image format supports transparency. Maybe first you will need to call

Image = Image.convertToFormat(QImage::Format_ARGB32); // or maybe other format
Uga Buga
  • 1,724
  • 3
  • 19
  • 38