QImage img(_pixmap.size(), QImage::Format_ARGB32); QImage img2 = _pixmap.toImage(); QRgb clr0 = img2.pixel(0, 0); for (int n = 0; n < img.width(); ++n) { for (int m = 0; m < img.height(); ++m) { QRgb clr = img2.pixel(n, m); if (clr == clr0) { clr = qRgba(255, 255, 255, 0); } img.setPixel(n, m, clr); } }
C++ (Qt) _img = QImage(_label.size(), QImage::Format_ARGB32); _label.render(&_img); QRgb clr0 = _img.pixel(0, 0); for (int n = 0; n < _img.width(); ++n) { for (int m = 0; m < _img.height(); ++m) { QRgb clr = _img.pixel(n, m); if (clr == clr0) { _img.setPixel(n, m, 0x00ffffff); } } }