Skip to content

Get Rid of - iCCP: Not recognizing known sRGB profile that has been edited

May 4th, 2015 - Software

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:

  1. Install ImageMagick
  2. 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.

@ECHO OFF
SETLOCAL enabledelayedexpansion

set "convert=C:\Pgm\java-32\ImageMagick-6.9.1-Q16\mogrify.exe"
set "identify=C:\Pgm\java-32\ImageMagick-6.9.1-Q16\identify.exe"

rem cd resources\images
cd app
FOR /R "." %%G in (*.png) DO (
    call :subroutine "%%G"
)
rem cd ..\..
cd ..
goto :EOF

:subroutine
  set "var=%1"
  set "tmp=%1_c.png"
  rem echo %var%
  if not x%var:src=%==x%var% (
    echo Changing %var%
    rem %identify% %var%
    echo %convert% -strip %var%
  )
  goto :EOF

EOF:

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 ”*” .

HTH,

Share on
Reddit
Linked in
Whatsapp

A little experiment: