Get Rid of – iCCP: Not recognizing known sRGB profile that has been edited
The past weeks I compiled an android app and I was getting:
AAPT: …. iCCP: Not recognizing known sRGB profile that has been edited
Not so nice. I found out that it was because AAPT is compiled against a newer libpng. Since the PNGs I had were not stock ones, the only way to get rid of these warnings would be to fix the color profile. I tried re-exporting with GIMP to no avail :(. However, according to this post, ImageMagick works. So, here are the steps I did:
- Install ImageMagick
- Write a script to batch-strip the color information from the image
Installing ImageMagick is somewhat easy. OSX users can use homebrew. Linux users can use things like apt-get. On windows, I found it better to download the statically linked version (…static.exe installer).
Since I’m on windows right now, I ended up writing a script. It has the following assumptions:
- It’s placed in the root of your project
- The project has a standard structure with an “app” module (like Android Studio creates it)
- ImageMagick is installed in C:\Pgm\java-32\ImageMagick-6.9.1-Q16
The script looks like this:
rem Copyright (c) 2015 Laur IVAN
rem Public domain. I’m not responsible for its side-effects.
rem cd resources\images
FOR /R "." %%G in (*.png) DO (
call :subroutine "%%G"
rem cd ..\..
rem echo %var%
if not x%var:src=%==x%var% (
echo Changing %var%
rem %identify% %var%
echo %convert% -strip %var%
The script uses mogrify and not convert, because I only want to change the source file. The -strip flag will strip all information form the image. So if you have something with a copyright you may want to use something like +profile "*" .
A little experiment: If you find this post and ad below useful, please check the ad out :-)