Bug report #19747
Warning: libpng warning: iCCP: known incorrect sRGB profile
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Unknown | ||
Affected QGIS version: | 3.3(master) | Regression?: | No |
Operating System: | Easy fix?: | Yes | |
Pull Request or Patch supplied: | No | Resolution: | up/downstream |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 27572 |
Description
I always thought the "Warning: libpng warning: iCCP: known incorrect sRGB profile" messages in the terminal on QGIS launch were something local to my machine.
Today I decided to look into it and found that it is actually bad metadata embedded in some of the PNG icons of plugins (potentially also in files that are not accessed on start-up, I did not check).
https://stackoverflow.com/questions/22745076/libpng-warning-iccp-known-incorrect-srgb-profile has a nice overview and proposed fixes for removing this bad metadata.
I tested it successfully with icon.png from GeodesicDensifier: https://github.com/GeoscienceAustralia/GeodesicDensifier
Before:
$ strace -e file qgis 2>&1 | grep -C 5 "iCCP:" | grep "GeodesicDensifier/icon.png" ... openat(AT_FDCWD, "/home/me/.local/share/QGIS/QGIS3/profiles/default/python/plugins/GeodesicDensifier/icon.png", O_RDONLY|O_CLOEXEC) = 30 statx(30, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=3090, ...}) = 0 statx(30, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=3090, ...}) = 0 Warning: libpng warning: iCCP: known incorrect sRGB profile statx(30, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=3090, ...}) = 0 statx(30, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=3090, ...}) = 0
After pngcrush -ow -rem allb -reduce
(does more than needed but nothing bad):
$ strace -e file qgis 2>&1 | grep -C 5 "iCCP:" | grep "GeodesicDensifier/icon.png" ...
But that requires each author of the affected plugins to fix it. I could not find any hint of a way to supress the warning on the QGIS/Qt side.
So, just filing this here for others to find. :)
History
#1 Updated by Johannes Kroeger about 6 years ago
To get a list of affected files: find . -type f -iname '*.png' -exec pngcrush -n -q {} \; 2>&1 | grep -B 2 "iCCP: known incorrect sRGB profile" | grep ".png:"
#2 Updated by Johannes Kroeger about 6 years ago
Actually, even after processing all my local plugins with this, I get three messages on QGIS launch. Two very early on (around "setting up the GUI") and one left-over at the plugin stage. I could not figure out which files caused those via strace.
Looking through the QGIS git repository I found (please ignore the leading directories):
./src/qgis/tests/testdata/control_images/expected_qgis_local_server/expected_qgis_local_server.png ./src/qgis/doc/images/projects/thumbnails/b3196a2b5781e788e6adac40ecf6964eddc4d38e.png.100x50_q85.png ./src/qgis/doc/images/projects/thumbnails/5a65a575314f063d065ef84840e734e411c770f2.png.100x50_q85.png ./src/qgis/images/north_arrows/default.png ./src/qgis/src/plugins/georeferencer/icons_old/default/mActionTransformSettings.png
Of those I only have the doc thumbnails on my system. Fixing those with pngcrush -ow -rem allb -reduce
does not get rid of the warnings at launch.
Anyone got an idea which files (maybe embedded somehow?) cause those?
#3 Updated by Johannes Kroeger about 6 years ago
- Status changed from Closed to Reopened
opening to gather feedback
#4 Updated by Nyall Dawson about 6 years ago
- Status changed from Reopened to Closed
Unfortunately some of these are thrown from PNGs inside webkit, and are caused when we import WebKit libraries. This needs to be fixed upstream.
#5 Updated by Johannes Kroeger about 6 years ago
Thanks, I filed https://bugs.webkit.org/show_bug.cgi?id=189230
#6 Updated by Kalin KOZHUHAROV about 6 years ago
Indeed...
I found the two files, but `mogrify` and `pngcrush` on them does not fix the warnings (they are no longer with incorrect iCCP profile).
./src/qgis/doc/images/projects/thumbnails/b3196a2b5781e788e6adac40ecf6964eddc4d38e.png.100x50_q85.png
./src/qgis/doc/images/projects/thumbnails/5a65a575314f063d065ef84840e734e411c770f2.png.100x50_q85.png
There is something more involved, probably a generated PNG ?!?
I tried to locate files with the following:
$ strace -f -o /tmp/qgis.trace -s512 -e trace=file qgis
Warning: QSqlQuery::prepare: database not open
Warning: libpng warning: iCCP: known incorrect sRGB profile
Warning: libpng warning: iCCP: known incorrect sRGB profile
$ cat /tmp/qgis.trace|grep -i "\.png"|fgrep -v ENOENT|cut -d'"' -f2|sort -u
/usr/share/qgis/images/icons/qgis-icon-60x60.png
$ pngcrush -n -q /usr/share/qgis/images/icons/qgis-icon-60x60.png
/usr/share/qgis/images/icons/qgis-icon-60x60.png:
Total length of data found in critical chunks = 3746
CPU time decode 0.000109, encode 0.000000, other 0.000103, total 0.000250 sec
So the only png from disk is the above and it is not a problem...
A had a go with gdb, but since most stuff is not complied with debug, I quickly gave up...
Anybody has pointers as to where to go on from here?
How to find what file (probably not image) contained the bad sRGB profile?