Remove incorrect sRGB profiles from png files using pngcrush:
pngcrush -ow -rem allb -reduce file.png
-ow will overwrite the input file
-rem allb will remove all auxiliary blocks except tRNS and gAMA
-reduce Perform lossless color type or bit depth reduction
In the console output you should see Removed the sRGB chunk, and possibly more messages about chunk removal. You'll end up with a smaller, optimized PNG file. Since this command will overwrite the original file, make sure to create a backup or use version control.
Some applications treat warnings as errors; if you are using such an application, you must remove this block. You can do this using any kind of PNG editor, such as ImageMagick.
Using Windows CMD prompt, you need to cd (change directory) to the folder containing the images you want to focus on before you can use the commands listed below.
Libpng-1.6 has stricter checks for ICC profiles than previous versions; you can ignore the warning. To get rid of it, remove the iCCP block from the PNG image.
convert in.png out.png
To remove invalid iCCP blocks from all PNG files in a folder (directory), you can use mogrify from ImageMagick:
mogrify *.png
This requires that your ImageMagick is built with libpng16. You can easily check it by running:
convert -list format | grep PNG
If you want to find out which files need to be repaired instead of blindly processing them all, you can run
pngcrush -n -q *.png
Where -n means not to rewrite the file, -q means to suppress most output except warnings. Sorry, there is no option yet in pngcrush to suppress everything except warnings.
Remove incorrect sRGB profiles from png files using
pngcrush
:-ow
will overwrite the input file-rem allb
will remove all auxiliary blocks except tRNS and gAMA-reduce
Perform lossless color type or bit depth reductionIn the console output you should see
Removed the sRGB chunk
, and possibly more messages about chunk removal. You'll end up with a smaller, optimized PNG file. Since this command will overwrite the original file, make sure to create a backup or use version control.Some applications treat warnings as errors; if you are using such an application, you must remove this block. You can do this using any kind of PNG editor, such as ImageMagick.
Using Windows CMD prompt, you need to
cd
(change directory) to the folder containing the images you want to focus on before you can use the commands listed below.Libpng-1.6 has stricter checks for ICC profiles than previous versions; you can ignore the warning. To get rid of it, remove the iCCP block from the PNG image.
To remove invalid iCCP blocks from all PNG files in a folder (directory), you can use
mogrify
from ImageMagick:This requires that your ImageMagick is built with libpng16. You can easily check it by running:
If you want to find out which files need to be repaired instead of blindly processing them all, you can run
Where
-n
means not to rewrite the file,-q
means to suppress most output except warnings. Sorry, there is no option yet in pngcrush to suppress everything except warnings.Note: You must have pngcrush installed.
Binary versions of ImageMagick are located here
For Android projects (Android Studio), navigate to the
res
folder.For example: