Skip to content

Instantly share code, notes, and snippets.

@iobzo
Forked from bluenex/libpng_fix.md
Last active November 14, 2015 02:36
Show Gist options
  • Save iobzo/128ce4ca7f04bb2c7106 to your computer and use it in GitHub Desktop.
Save iobzo/128ce4ca7f04bb2c7106 to your computer and use it in GitHub Desktop.
fixing 'libpng warning: iCCP: known incorrect sRGB profile' appears in Qt5.5

Libpng warning: iCCP: known incorrect sRGB profile.

Some .png images used in pygame may get the warning read as "libpng warning: iCCP: known incorrect sRGB profile". To solve this I have searched and found the solution by using ImageMagick. After installing, single file can be fixed by calling convert <in_img> -strip <out_img>, but to make it fixes every wanted images in path we'll need to modify just a little bit.

Create .bat file contains the following code and place this .bat in the folder that want to be fixed and run to finish it out.

@echo off
ping -n 2 127.0.0.1 > nul

echo this batch will convert ".png" using -strip option from ImageMagick.
echo please make sure you place a batch file in the right location.

ping -n 1 127.0.0.1 > nul

for /f  "tokens=* delims= " %%a in ('dir /s/b/a-d "*.png"') do (
echo "%%a"
identify "%%a"
convert "%%a" -strip "%%a"
identify "%%a")

echo finish..

ping -n 2 127.0.0.1 > nul
set /P user_input=Press any key to terminate...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment