25

when including .png converted with Photoshop CS6 to grayscale I get a warning "warning: pdflatex> libpng warning: iCCP: known incorrect sRGB profile"

to be precise, I get 36 of this warnings ;-)

what's the problem with these .png?

30

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
  • 7
    How do you disable this warning? – Mario S. E. Jul 25 '14 at 21:03
  • @MarioS.E. Look at nag package for filtering and shutting it up for various warnings. – percusse Feb 12 '15 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 '15 at 20:22
  • What do you mean by a '.png which is broken'? – Nicholas Hamilton May 22 '15 at 5:30
  • 1
    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 '15 at 9:40
11

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

find . -type f -name "*.png" -exec convert {} -strip {} \;
  • Is there any way to do this with GIMP? – matheburg Oct 22 '14 at 7:12
  • sudo find . -type f -name "*.png" -exec src/main/res/drawable-hdpi {} -strip {} \; getting error permission denined – Krunal Shah Dec 18 '14 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 {} \; – Olaf Dietsche Apr 26 '15 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 '15 at 20:23
4

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
    Interesting... I used to think it is 50 shades of gray only :D – Germán Diago Feb 21 '15 at 6:33
1

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.