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
1
vote
1 answer
SDL2_image not initializing
Im trying to load a .png file with SDL2 and SDL2_image. SDL2 initializes properly while SDL2_image just fails for no apparent reason, please help.
IMG_Init() returns 0
IMG_GetError() returns nothing
I'm using SDL2 2.0.10 and SDL2_image 2.0.5 (latest…

Nourios
- 41
- 4
1
vote
0 answers
C++ Opengl with SDL2_image texture showing white only
I'm trying to display a spinning cube with 6 different textures (all jpg and jpeg) using SDL library. But the program only shows white squares only. Anyone can please explain what happened to these textures?
each function behavior
opengl_init():…
user6417628
1
vote
0 answers
Library management and search paths on macOS?
I created a simple program that shows an image (bmp) file but now I would like to load a jpg file and I found the "SDL_image" library that seems to do what I need, the dmg file I have mounted, contains a file SDL2_image.framework and a readme.txt…

navy1978
- 1,411
- 1
- 15
- 35
1
vote
1 answer
How do I configure SDL_image to use a version of SDL in a peer directory?
I have built SDL in a folder ~/project/extra/SDL/ and I'm trying to build SDL_image in ~project/extra/SDL_image. SDL is not installed, the project is statically linking to the ~/project/extra/SDL/build/.libs/*.a library.
How do I configure SDL_image…

Justin808
- 20,859
- 46
- 160
- 265
1
vote
2 answers
Loading a OpenGL Image with SDL-image
As it says above: How can I employ the image loading facilities of the SDL-image binding to Haskell to load a OpenGL texture, as you so often do in C. SDL-image supports a nice variety of image formats, but only delivers a Surface data type. For…

Lanbo
- 15,118
- 16
- 70
- 147
1
vote
1 answer
SDL_RenderCopy not doing anything
I'm calling SDL_RenderCopy and it gets called and returns normally but doesn't draw anything to the window. Edited to make the question and code clearer. I'm thinking I might be trying to use something beyond its scope and hence it can't be called…

SorSorSor
- 21
- 6
1
vote
0 answers
SDL2 image - IMG_Init() returns 0, with IMG_GetError() being empty
I'm trying to load a png image with SDL2. However, even though the file exists and the renderer is created correctly, IMG_LoadTexture will only return a nullptr, for no apparent reason.
The function I'm using IMG_LoadTexture in looks like this,…

L. Kue
- 473
- 5
- 19
1
vote
1 answer
Can't load image in SDL game on macOS
I'm watching the tutorial for adding image in SDL game, but author uses Visual Studio. I'm on the XCode and I'm not sure where to add the assets folder. I tried with right click on root of application > Add files to "Project" > destination of the…

Nikola Stojaković
- 2,257
- 4
- 27
- 49
1
vote
1 answer
SDL2 IMG_LoadTexture can't find the texture from asset - Android
I'm trying to understand why SDL2 compiled for Android can't find the JPG (or bmp,or png) texture file using this code:
/** Prepare textures */
static SDL_Texture *img = NULL;
int w, h; // texture width & height
// load our image
if (img…

juaxix
- 63
- 7
1
vote
1 answer
SDL_Texture causes everything to render black
I have been working on a fairly large app in SDL for a while and recently noticed a strange bug; whenever a window is closed, everything on another window will render completely black. When I draw red a line, it will be black, and when I draw an…

Mashpoe
- 504
- 1
- 9
- 27
1
vote
1 answer
unexpected behavior while using SDL_image for texture in Vulkan
i managed to load jpg images and use them as textures in vulkan, however different images give different results, with some images it works just fine, with others it does not map well.
here is the code block related to image loading and format…

BulBul
- 1,159
- 3
- 24
- 37
1
vote
1 answer
Encode image and change color in SDL2 and C ++
Is there a method or function that: when loading a texture, it is coded to apply color changes?
How Sprite Works in NES

Islam Linarez
- 169
- 8
1
vote
1 answer
SDL2 IMG_Load "unsupported image format" error message?
I'm trying to load a png image. libsdl2-dev and libsdl2-image-dev packages have been installed and I'm including SDL2/SDL_image.h. IMG_Init is working without error, but IMG_Load errors.
On my desktop PC (Ubuntu) it works (loads png into…

Kieren Anderson
- 508
- 3
- 16
1
vote
0 answers
SDL - Surfaces must not be locked during blit
I'm trying to write a simple game in C. I use SDL2 to draw stuffs. Here is a main loop:
...
while( !quit_f )
{
//Handle events on queue
while( SDL_PollEvent( &e ) != 0 )
{
//User requests quit
if( e.type == SDL_QUIT )
…

Pruky
- 11
- 3
1
vote
1 answer
SDL OpenGL Textures Plagued with Green Tint
I am receiving an unexpected output when attempting to use SDL_image to load an image to an OpenGL texture.
The pertinent parts of my code are:
/**
* Load texture
* @param {char*} [filename] File name to load
* @param {int*} [textw] Texture width…

Mike B
- 73
- 8