#include <QApplication> #include <QPixmap> #include <QImage> #include <QRgb> #include <QDebug> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPixmap pixmap("D:\\Code\\Qt\\popup\\logo.ico"); QImage image = pixmap.toImage(); for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { QRgb pixel = image.pixel(x, y); if (qAlpha(pixel) == 0){ qDebug()<<"透明像素点"<<endl; }else { image.setPixel(x, y, qRgb(255, 255, 0)); } } } pixmap = QPixmap::fromImage(image); pixmap.save("D:\\Code\\Qt\\popup\\modified_image.ico"); qDebug() << "ICO image modification complete."; return 0; }
标签:ico,int,image,pixel,修改,include,像素点 From: https://www.cnblogs.com/Galesaur-wcy/p/17476691.html