Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fixing 'libpng warning: iCCP: known incorrect sRGB profile' appears in Pygame.

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 %%i in (*.png) do identify %%i
for %%i in (*.png) do convert %%i -strip %%i
for %%i in (*.png) do identify %%i

echo finish..

ping -n 2 127.0.0.1 > nul
set /P user_input=Press any key to terminate...
@iobzo

This comment has been minimized.

Copy link

@iobzo iobzo commented Oct 20, 2015

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

@jdelange

This comment has been minimized.

Copy link

@jdelange jdelange commented Feb 27, 2016

Works great! Thanks.

@IIIullaIII

This comment has been minimized.

Copy link

@IIIullaIII IIIullaIII commented Feb 2, 2019

no work in win10
( identify is unknow internal/external command exe or file .bat )
how fix

@Lulala

This comment has been minimized.

Copy link

@Lulala Lulala commented Apr 13, 2019

Thanks.I didn't install ImageMagick. After running .bat in the working environment and pressing Enter, there is no Libpng warning: iCCP: illustrates incorrect sRGB profile.

@iseegr8tfuldeadppl

This comment has been minimized.

Copy link

@iseegr8tfuldeadppl iseegr8tfuldeadppl commented Apr 17, 2019

Make sure when you're installing ImageMagick to select "Install Legacy Utilities (eg. convert)
and it will work!

@SarahKay99

This comment has been minimized.

Copy link

@SarahKay99 SarahKay99 commented Feb 19, 2020

What should we write in the command line to run the file? Sorry if this sounds silly but I have never worked with .bat before

@JampaSax

This comment has been minimized.

Copy link

@JampaSax JampaSax commented Apr 14, 2020

I use GIMP to fix this problem. Open the image that is causing the problem. Then go to Image -> Mode -> Assign Colour Profile, and chose RGB Workspace. And export the "new" image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.