qt open a jpg file with warning image format not supported

↘锁芯ラ 提交于 2019-12-12 06:50:39

问题


I open a file of format "jpg" in qt creator ,but qt creator returns a warning with "image format not supported". I also try other format as "png" ,but the waring is same.I hope someone can give me advice on it.I really need help.


回答1:


This Warning is about PNG formats and Qt, Irrelevant to @ztono code. Read more about PNG (Portable Network Graphics) https://en.wikipedia.org/wiki/Portable_Network_Graphics

PNG has many Formats some old, some not standard for Qt. see more History_and_development You need to use Standard format in Qt.

You can convert your image to PNG Standard with Software.

OR

You can use QImage in Qt to convert your PNG pictures.

QImage *image = new QImage();
image->load("E:/Qt/TestProject/Images/connect.png");
image->save("E:/Qt/TestProject/Images/connect2.png");

Use new converted png and you will not see the warning.



来源:https://stackoverflow.com/questions/43374187/qt-open-a-jpg-file-with-warning-image-format-not-supported

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!