Stripping sRGB profile from PNGs in python

Ryan Holmes ryan.xgamer99 at
Thu Jul 23 19:31:21 CEST 2015

We're getting this error when trying to load some of out projects images:
    libpng warning: iCCP: known incorrect sRGB profile

The source files that we have some with incorrect sRGB profiles. We don't have control over the source files, but what we normally do is take them and scale them down for our own project. To fix this issue, we can use this shell one-liner:

    find . -type f -name "*.png" -exec convert {} {} \;

Which basically converts the ONGs into themselves, but it strips the profile (or maybe overwrites with a correct profile).

We would like to incorporate this functionality into our python script which scales the source images, but we haven' found a way to do this. Any thoughts?


More information about the Python-list mailing list