# Could not load PNG in SDL2?

I have three image files, one is Techs.png, one is Techs.gif and one is Techs.bmp. I have used SDL_image 2.0.5 and SDL 2. When I load the image of Techs.gif and Techs.bmp, there is no error, but when I load the image of Techs.png. SDL_Surface*Surface=IMG_Load("Techs.png"), an error occurs, I cannot load this image and Surface always returns NULL, I am using Visual Studio 2019. Can someone help me, thanks.

• What error message do you get? – DMGregory Nov 29 '19 at 1:24
• That Error is Surface of this Image is always returns NULL and i cann't load it to the screen. – Traistorm Nov 29 '19 at 1:41
• Ok, what error message do you get? Or are you meaning that you don't get an error message, that the returned value is always nullptr? – Vaillancourt Nov 29 '19 at 1:51
• Also, can we assume that you read the doc and used IMG_GetError() to get the error message? – Vaillancourt Nov 29 '19 at 1:57
• "Failed loading libpng16-16.dll: The specified module could not be found." Did you also copy libpng16-16.dll? – Vaillancourt Nov 29 '19 at 2:27

In this case, we can see that there is a function called IMG_GetError() which should be used to retrieve a human readable message of the error you got.
• @Traistorm For future users, it might be helpful to mention what the problem was. I imagine its that SDL does not support loading png files by default and you had to use the SDL_Image extention? It would be good for this to be mentioned somewhere. – TomTsagk Nov 29 '19 at 10:16