26

When including .png converted with Photoshop CS6 to gray-scale I get a warning

"warning: pdflatex> libpng warning: iCCP: known incorrect sRGB profile".

To be precise, I get 36 of these warnings. ;-)

What is the problem with these .png?

5 Answers 5

31

The newest libpng update (1.6.2 I believe?) has stricter rules about iCCP and will print this warning every time it finds a png that is broken. This warning can be ignored. Fixes would include:

  • Downgrade to a older version of libpng
  • Install imagemagick and convert all .png files with convert -strip (script below)
  • Maybe even just disable this warning?

In the end this is a problem that should be fixed by the maintainer of the code.

Script that would change all .png files in the current directory:

for f in $(find . -type f -name "*.png")
do
echo "Processing $f ..."
convert $f -strip $f
done
5
  • 8
    How do you disable this warning? Jul 25, 2014 at 21:03
  • @MarioS.E. Look at nag package for filtering and shutting it up for various warnings.
    – percusse
    Feb 12, 2015 at 14:54
  • 2
    In my case a simple convert $f $f was enough, no need to use -strip which might change your image colors.
    – zakkak
    May 3, 2015 at 20:22
  • 1
    What do you mean by a '.png which is broken'? May 22, 2015 at 5:30
  • 3
    I do not believe that the PNGs are "broken". In my case, they have been generated by Photoshop, a software I trust more than libpng.
    – Rene
    Dec 29, 2015 at 9:40
12

To strip all .png files with ImageMagick, you can simply run the following command

find . -type f -name "*.png" -exec convert {} -strip {} \;
4
  • Is there any way to do this with GIMP?
    – matheburg
    Oct 22, 2014 at 7:12
  • sudo find . -type f -name "*.png" -exec src/main/res/drawable-hdpi {} -strip {} \; getting error permission denined Dec 18, 2014 at 6:32
  • @KrunalShah convert is the name of an ImageMagick executable. If you want to convert all png images in this subdirectory: find src/main/res/drawable-hdpi -type f -name "*.png" -exec convert {} -strip {} \; Apr 26, 2015 at 11:46
  • 1
    In my case a simple convert {} {} was enough, no need to use -strip which might change your image colors.
    – zakkak
    May 3, 2015 at 20:23
5

Saving the image with a lower bit depth will probably eliminate the problem altogether; since you have no real color variance and no alpha, 8-bit should look the same.

The reason is that with grayscale, you only really have 256 shades of gray with no RGB variance, and of course, no alpha.

1
  • 2
    Interesting... I used to think it is 50 shades of gray only :D Feb 21, 2015 at 6:33
2

I found a workaround that may help.

I downloaded the ImageOptim software: https://imageoptim.com/ (Free)

and went to the folder Xamarin/Android.Support.v7.AppCompat/21.0.3/embedded and drag the images into the imageoptim and it deleted the metadata.

And that fixed.

1
2

I am a Graphic Designer (not a coder so please excuss my ignorance) who was asked to save the image from Photoshop without sRGB profile to avoid this warning message by one of my colleagues. The simplest solution I found is to: 'Save for Web' from Photoshop giving you far more options when saving a PNG than simply 'Save As' - within the addtional options you can simply untick the box for embeding the PNG with sRGB profile. Hope this is of some help to someone, it worked for us.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .