How about replacing each pixel with white color with a pixel with Qt::transparent.
img.load("test.jpg");
for (int i = 0; i < img.height(); i++)
{
for (int j = 0; j < img.width(); j++)
{
if(img.pixel(j, i) == qRgba(255,255,255,255))
img.setPixel(j, i, Qt::transparent);//Or you can use qRgba(0,0,0,0) instead for trans
}
}
img.save("changed.png");//I dont remember that png can alpha channel or not.
QImage img;
img.load("test.jpg");
for (int i = 0; i < img.height(); i++)
{
for (int j = 0; j < img.width(); j++)
{
if(img.pixel(j, i) == qRgba(255,255,255,255))
img.setPixel(j, i, Qt::transparent);//Or you can use qRgba(0,0,0,0) instead for trans
}
}
img.save("changed.png");//I dont remember that png can alpha channel or not.
To copy to clipboard, switch view to plain text mode
Bookmarks