[SOLVED] libpng warning: iCCP: known incorrect sRGB profile drive me nuts
-
When adding png exported from photoshop to Qrc
and using them in the program, I get
tons of
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
(one for each file..)
Which is pretty annoying.No other tool I have that reads png have an issue with these files, only libpng.
Its photoshop 2015. Profile is correct for all tools I have that can use png profiles.Can I somehow disable this warning ?
thanks -
Hi,
Looks like an image problem see this post or rather libpng that became more picky
-
mrjj Lifetime Qt Championreplied to SGaist on 6 Sept 2015, 20:53 last edited by mrjj 9 Jun 2015, 21:03
Well its the profile.
"it's because libpng 1.6 does more checking of the pngs, and one or more of the png files used has an old sRGB profile"But how can it be old when its a photoshop 2015 ?
No of the other tools consider the profile old.Its a strange warning as nothing is wrong with the profile and
its the std one.Reading here
http://www.imagemagick.org/discourse-server/viewtopic.php?t=25880it says
"The feature for skipping the sRGB profile-checking was added to libpng-1.6.12"So is there any way I could enable that for Qt ?
-
You'd have to rebuild the png plugin after "fixing" the sources to not do the check
-
@SGaist
Which means I would have to have VSxxx excact version , which I do not so I am going to try the libpng forums to find out what exactly it thinks is wrong with the embedded color profile. If only it would also print the file name....Thank you
-
Why ? You already have the compiler matching your Qt version, no need of more for testing the png plugin
-
@SGaist
Hi
But my Qt Creator is compiled with VS so I assumed that compiling a new png plugin with minGW is a no go ? (as in wont work) -
The Qt version used for Qt Creator and the one you use for your application doesn't need to match unless you are building a Qt Creator plugin but in the case of your tests to disable this warning, you don't need to build a Qt Creator plugin.
-
@SGaist
Ahh, now I understand you. (i think)
So you say I can create a new png plugin
and then load that in my application ?
I guess I have to put it in build folder/plugins for app to load the modified one? -
IIRC, the plugin will be replaced directly in your Qt installation once built
-
@SGaist
As in
D:\Qt\Tools\QtCreator\bin\plugins\imageformats
hmm
http://doc.qt.io/qt-5/qtimageformats-index.htmldont list PNG.
So its not a plugin but sort of build in ?
-
No, as in D:\Qt\5.5\MinGW\plugins\imageformats
Don't mix the Qt you use with Qt Creator.
PNG support is in qtbase (it's in the list on the second line of the first paragraph). But now that you mentioned it, you're right: it's builtin.
-
@SGaist
Ahh, of cause . Creator is Vs but mingw need its own version.
Hmm I getting blind, as I see no mention of qtbase but now i know.
Maybe I should try it on linux where all will be gcc. (I hope)Thank you for your time.
-
The Qt Gui module is in qtbase.
But again, it has nothing to do with Qt Creator, to make your tests with pngs, you'll have to build qtbase (only qtbase, no need for the rest) so it will be a new Qt version + corresponding Kit for Qt Creator
-
@SGaist
Ah. That way.
Is there anywhere I can see which modules are part of what etc? like an overview.
So qtbase.pro files must the one Im looking for.I assume getting the one from
git://gitorious.org/qt/qtbase.git.could work.
Thank you for all the info.
-
well it seems libpng follow standard and
photoshop is not strict enough, so I just have to live with it or
strip the profile completely."
Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad
profiles that were previously accepted are now rejected, in particular the
very old broken Microsoft/HP sRGB profile. The PNG spec requirement that
only grayscale profiles may appear in images with color type 0 or 4 and that
even if the image only contains gray pixels, only RGB profiles may appear
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type.
" -
@mrjj 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.
Answer To Your Problem: https://stackoverflow.com/questions/43374187/qt-open-a-jpg-file-with-warning-image-format-not-supported
-
mrjj Lifetime Qt Championreplied to aghilpro on 7 Jun 2017, 06:27 last edited by mrjj 6 Jul 2017, 06:28
@aghilpro
Actually it turn out it was the color profile that photoshop put in the png file and
libpng didn't like it. Seems to have vanish in later Qt versions. -
Open with -> Photoshop -> File -> Save for web... -> Save..
-
As a quick solution, you can fix that image using some optimisation utilities.
On the MacOS, I successfully solved this problem using theImageOptim
.
On other platforms, there is some similar tools such as theTrimage
for Linux and thepinga
for Windows, but I didn't test these.