Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL_Image IMG_Load fails on png with: "Failed loading libpng16-16.dll:"

Whenever I try to load a PNG using SDL_Image's IMG_Load function it gives the error Failed loading libpng16-16.dll:. I have all the right dll's in the right path and I can use other parts of SDL_Image, but for some reason it can't load the libpng dll. How can I fix this? Any help is appreciated.

like image 994
a sandwhich Avatar asked Jan 31 '14 05:01

a sandwhich


2 Answers

It appears that libpng16-16.dll has a dependency on zlib1.dll for MinGW-w64 (32-bit). Try to include zlib into your dependnecies--include the DLL in the folder where the executable runs.

like image 176
CinchBlue Avatar answered Sep 28 '22 06:09

CinchBlue


Very niche answer, but for those running into this issue because of pySDL2, it could be caused because your python interpreter is sub-par. For me, using the windows store install for python interpreter 3.10, gave this issue. However, when I switched to 3.10 from python.org all my issues were fixed.

like image 27
Yamm Elnekave Avatar answered Sep 28 '22 07:09

Yamm Elnekave