This is about a Warning issued by libpng
. Means the image file PNG
that you are using possesses Chunks iCCP invalid.
To remove the Chunks invalid of an image PNG
, you can use the utility convert
library ImageMagick
passing the argument -strip
at the command line:
$ convert icone.png -strip icone_ok.png
Assuming you have an image file, in the format PNG
, with dimensions of 400x400
, called icone.png
:
Follows a program capable of loading the image above through the function pygame.image.load()
and then use it as the icon of the window created through the function pygame.display.set_icon()
without any kind of error or Warning:
import sys
import pygame
pygame.init()
icon = pygame.image.load('icone.png')
screen = pygame.display.set_mode((500, 500))
pygame.display.set_caption('FooBar')
pygame.display.set_icon(icon)
screen.blit( icon, (50,50))
clk = pygame.time.Clock()
running = True;
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False;
pygame.display.update()
clk.tick(25);
pygame.quit()
sys.exit()
Example being tested in a desktop Linux/GNOME
:
Could you include the full code in the question ? Could you provide the image . png ? Can you reproduce/isolate errors in a minimal example ?
– Lacobus