Skip to content

Some png files have a known-bad sRGB profile #337

@DarkHelmet433

Description

@DarkHelmet433

I've been getting periodic 'iCCP: known incorrect sRGB profile' whenever I do things like 'show module market group'. I went looking and it turns out there was a bug in some old libpng code or png tools. Old versions of libpng ignore it, but newer versions of libpng now genenerate a warning.

The files in question are definitely incorrect. Any tool that uses newer versions of libpng will generate a warning. I picked one at random, in this case 'pngtogd' from the libgd package. When you run it, you get the error.

peter@overcee[ 9:50PM]~/Pyfa-1081> pngtogd ./staticdata/icons/icon107_3.png /tmp/foo.gd
libpng warning: iCCP: known incorrect sRGB profile

This is the exact same error that plagues the gui.

Whipping up a quick, dumb script to leverage this:

peter@overcee[ 9:52PM]~/Pyfa-1082> cat checkpng.sh 
#! /bin/sh
find . -name '*.png' -print | while read pngfile; do
  libpngoutput=$(pngtogd $pngfile /tmp/test.gd 2>&1)
  if [ -n "$libpngoutput" ]; then
    echo $pngfile
  fi
done
rm /tmp/test.gd

.. gives a list of troublesome png files:

peter@overcee[ 9:52PM]~/Pyfa-1083> sh checkpng.sh
./staticdata/icons/icon107_3.png
./staticdata/icons/icon105_46.png
./staticdata/icons/icon01_08.png
./staticdata/icons/icon105_48.png
./staticdata/icons/icon119_1.png
./staticdata/icons/icon108_17.png
./staticdata/icons/icon108_10.png
./staticdata/icons/icon113_64_2.png
./staticdata/icons/icon108_2.png
./staticdata/icons/icon108_5.png
./staticdata/icons/icon108_19.png
./staticdata/icons/icon105_49.png
./staticdata/icons/icon34_16.png
./staticdata/icons/icon105_47.png
./staticdata/icons/icon107_2.png
./staticdata/icons/icon118_64_7.png
./staticdata/icons/icon108_4.png
./staticdata/icons/icon108_18.png
./staticdata/icons/icon108_3.png
./staticdata/icons/icon108_11.png
./staticdata/icons/icon113_64_3.png
./staticdata/icons/iconMarketIcon_16px_Gallente.png
./staticdata/icons/icon108_16.png
./staticdata/icons/icon1337_22.png
./staticdata/icons/icon02_11.png
./staticdata/icons/icon108_7.png
./staticdata/icons/iconMarketIcon_16px_Minmatar.png
./staticdata/icons/icon108_15.png
./staticdata/icons/iconIcon_64px_Fireworks.png
./staticdata/icons/icon108_12.png
./staticdata/icons/icon1337_21.png
./staticdata/icons/icon108_20.png
./staticdata/icons/icon108_64_22.png
./staticdata/icons/icon107_1.png
./staticdata/icons/iconMarketIcon_16px_Amarr.png
./staticdata/icons/icon108_21.png
./staticdata/icons/icon108_13.png
./staticdata/icons/icon113_64_1.png
./staticdata/icons/icon108_8.png
./staticdata/icons/icon108_14.png
./staticdata/icons/icon108_6.png
./staticdata/icons/icon108_1.png
./staticdata/icons/iconMarketIcon_16px_Caldari.png
./staticdata/icons/iconremote_hull_repairer.png

Only 44 of the 400-ish png files have the problem. I personally used the ImageMagick "convert" tool to repair them:

peter@overcee[10:02PM]~/Pyfa-1087> convert ./staticdata/icons/icon107_3.png foo.png; mv foo.png ./staticdata/icons/icon107_3.png 

and repeat for all the other files. eg: another dumb script:

peter@overcee[10:11PM]~/Pyfa-1115> cat fixpng.sh 
#! /bin/sh
find . -name '*.png' -print | while read pngfile; do
  libpngoutput=$(pngtogd $pngfile /tmp/test.gd 2>&1)
  if [ -n "$libpngoutput" ]; then
    convert $pngfile fixed.png
    mv fixed.png $pngfile
  fi
done
rm /tmp/test.gd

and its fixed:

peter@overcee[10:11PM]~/Pyfa-1116> sh fixpng.sh  
peter@overcee[10:12PM]~/Pyfa-1117> sh checkpng.sh 
peter@overcee[10:12PM]~/Pyfa-1118> 

This completely solves the pyfa gui problem that causes the 'iCCP: known incorrect sRGB profile' that pops up when using it.

For what its worth, the png version I'm using is 1.6.17. I don't see the sRGB warnings on osx / windows builds - they have a different png version.

I'm not sure how this fits with your use of extracting data from eve. I assume that the source eve resource data must have the sRGB problem. Perhaps it might be possible to add an explicit check / convert / rerender / repair pass when updating the staticdata files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions