QT中出现:

libpng warning: iCCP: known incorrect sRGB profilelibpng

warning: iCCP: cHRM chunk does not match sRGB

这样的警告,处理方法如下:

将所有的png获取其他图片,用QImage读出来,在保存下去,就可以了:

代码如下:


#include "mainwindow.h"
#include <QApplication>
#include <QImage>
#include <QDir>
#include <QStringList>
#include <QDebug>
int main(int argc, char *argv[])
{
QString mPath("F:\\qt-eye-fundus\\ui_image");
QStringList mImagePath;
QDir dir(mPath);
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Size | QDir::Reversed);
QImage image;
QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
qDebug() << qPrintable(QString("%1 %2").arg(fileInfo.size(), 10)
.arg(fileInfo.fileName()));
QString filepath;
filepath.append(fileInfo.path());
filepath+="\\"+fileInfo.fileName();
qDebug()<<filepath;
mImagePath.push_back(filepath);
image.load(filepath);
image.save(filepath);
}



}