SDL_image is an image file loading library. It loads images as SDL surfaces, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV.
Questions tagged [sdl-image]
156 questions
38
votes
6 answers
How to use SDL2 and SDL_image with cmake
I'm looking for the simplest way to compile a c++ program using SDL2 and SDL_image with cmake.
Here is my best attempt, after hours of searching:
CMakeLists.txt
project(shooter-cmake2)
cmake_minimum_required(VERSION…

Carl Lemaire
- 383
- 1
- 3
- 7
17
votes
5 answers
How to statically compile an SDL game on Windows
I have been trying to produce a statically linked "single binary" version of my game for windows. I want to link with sdl, sdl_image and sdl_mixer which in turn pull in a few support libraries. Unfortunately I haven't found a way to get them all to…

Sec
- 7,059
- 6
- 31
- 58
16
votes
4 answers
SDL2_image not found
I am trying to compile the following code which has the headers:
#include
#include
However after running the following makefile:
g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image
I get the following error:
fatal…

mas4
- 989
- 1
- 8
- 20
12
votes
1 answer
C++: weird error "expected initializer before extern" in library SDL_image.h
I'm currently trying to make a simple game with SDL and Box2D. Unfortunately, the code I added to make the character shoot proyectiles is so buggy I can't even begin to count the errors. To deal with this I added some code to show some debug info in…

Magnus
- 514
- 2
- 7
- 19
9
votes
6 answers
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…

a sandwhich
- 4,352
- 12
- 41
- 62
7
votes
2 answers
Using .reset() to free a boost::shared_ptr with sole ownership
I'm storing an object (TTF_Font) in a shared_ptr that is provided to me from a third-party API. I cannot use new or delete on the object, so the shared_ptr is also provided a "freeing" functor.
// Functor
struct CloseFont
{
void…

Zack The Human
- 8,373
- 7
- 39
- 60
5
votes
2 answers
How to fix 'The procedure entry point SDL_RWclose could not be located in the dynamic link library'
I'm trying to draw a png image to a window using the SDL_image extension, but it gives me an "Entry Point Not Found" error
I'm using SDL (2.0.9) and SDL_Image (2.0.5)
I've copied the following bin files to the executable…

linjoehan
- 103
- 1
- 5
5
votes
2 answers
SDL save screenshot on iOS
I am trying to save a screen or frame from the SDL's "window" into a PNG file and so I'm using SDL_image library. My code is below
IMG_Init(Int32(IMG_INIT_PNG.rawValue))
let screenShot = SDL_CreateRGBSurface(0, 640, 480, 32, 0, 0, 0,…

Lawrence Gimenez
- 2,662
- 4
- 34
- 52
5
votes
2 answers
SDL_image's IMG_Load do not work
I am using IMG_Load() to load png file, but it simply not working.
loadedImage = IMG_Load(filename.c_str()); after this sentence, loadedImage is still NULL,not error happened.
PS:I am using VS C++2008, png file is in the develop folder. Here is my…

Converse
- 141
- 1
- 1
- 5
5
votes
3 answers
‘IMG_Load’ was not declared in this scope SDL 2
I'm trying to make an application with SDL and I would like to add an icon on my window but when I compile I get this error :
error: ‘IMG_Load’ was not declared in this scope
SDL_Surface * icon_surface = IMG_Load(icon);
…

geauser
- 1,005
- 8
- 20
5
votes
3 answers
"Undefined Reference To 'IMG_Load'" CodeBlocks and SDL_Image Error
I'm learning SDL through Lazy Foo's tutorial, but I can't proceed further as IMG_Load doesn't seem to work. I tried setting it up like he says, but it just doesn't work. I put all the include files into include folder, and all the lib files into the…
user2588543
5
votes
1 answer
SDL_image won't install
I'm trying to install the SDL-image library for Haskell, a set of bindings for the original C library of the same name. I've already built and installed the SDL library and its corresponding Haskell package, and dropped the files from the SDL-image…

Einar
- 151
- 1
- 4
4
votes
4 answers
Linking SDL2/SD2_image statically with CMake
I'm trying to add SDL2 as a library to my project. I want to link it statically. I'm new to c++.
1 - Why does the SDL website recommend linking dynamically whenever possible?
I understand the benefits of dynamic libs. However, assuming users will…

frankelot
- 13,666
- 16
- 54
- 89
4
votes
1 answer
SDL Surface Pixel Format Conversion
I want to convert an SDL_Surface, which was loaded by IMG_Load() to an other pixel format (rgba8) for an OpenGL Texture. How can I do that?
I've read about SDL_ConvertSurface() in the documentation, but I can't figure out, how to put it together.

gufftan
- 153
- 5
- 13
4
votes
1 answer
"Frame not in module" when using glTexImage2D
I have never come across this error before and I use glTexImage2D elsewhere in the project without error. Below is a screenshot of what error Visual Studio shows, and a view of the disassembly:
Given the line has ptr in it I assume there's a…

jaunt
- 4,978
- 4
- 33
- 54