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
0
votes
0 answers
How to load image with IMG_Load() without the byte padding for each line?
If i load image such as 98x*** which is 3 bytes per pixel, it will create 2 bytes padding there to make it fit in 4 bytes sequences.
Is it possible to use IMG_Load() without generating the padded bytes in the ->pixels raw data?
At the moment i use…

Rookie
- 3,753
- 5
- 33
- 33
0
votes
0 answers
CMake build SDL_image from source under Winows
i work on Windows x64 with cmake and Mscv compiler Version 19.28.29913.
I included SDL and SDL_image as submodules in my project.
All works fine until i tried to build SDL_image into my project.
My CMakeLists.txt looks like following
...
#add…

LonelyDriver
- 27
- 4
0
votes
0 answers
LINK : fatal error LNK1104: cannot open file 'external\jpeg-9d\Debug\jpeg.lib'
I am including SDL and SDL_image as project dependencies via git submodules. SDL_image contains multiple external dependencies itself, including the problematic jpeg library. The overall project structure looks like this:
│ …

thedarklord47
- 3,183
- 3
- 26
- 55
0
votes
1 answer
how to load images in sdl to a surface in c using IMG_Load?
When I run
SDL_Surface* surface = IMG_Load("*image location*");
an error pops up saying
initialization of 'SDL_Surface *' {aka 'struct SDL_Surface *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
I don't know why this…

sababugs112
- 9
- 3
0
votes
0 answers
SDL2 C the image is not displayed
I want to create a quiz game. As a first state i want a menu to show up and i want to do it like if the image start is clicked than change a state. So the problem is that my picture with menu didn't even show up. And i have one more question. If for…

matthews
- 11
- 3
0
votes
0 answers
Adding a SDL_image in Codeblocks 20.03
I am using CodeBlocks 20.03 and I want to use SDL_Image library to load JPEG, JPG and other image formats in my program. For that reason, I installed SDL_2.0.14 from the sdl website as a development library but not the runtime one. Now I copied all…

M.Riyan
- 79
- 5
0
votes
0 answers
IMG_Load() doesn't work properly when using with CMake
I'm trying to make a game on vscode with CMake. Everything was fine until I try to show a png image on the screen. I had initialized and linked everything correctly and there are no errors that occur except this:
"Couldn't open…

Thinh Tran
- 776
- 1
- 7
- 11
0
votes
2 answers
This function cause the window to be blank then crashes
I'm trying to find why thus code doesn't work, and after some testing I found that the function submitSprite has the cause of the crash in it, but I don't know how to fix it
#include "renderer.h"
Renderer newRenderer(SDL_Window* window)
{
…

Gabryx86_64
- 31
- 4
0
votes
1 answer
SDL application exits without entering main - SDL Image
I have an application that runs fine on Ubuntu but immediately exit at startup, WITHOUT ANY ERRORS, on Windows.
It seems that main() function is not entered.
Application has been compiled without errors and it uses SDL_image.h. When (in the same…

Francesco
- 523
- 4
- 25
0
votes
0 answers
SDL_CreateTextureFromSurface() returns NULL surface
When loading a PNG image on my SDL program I used the SDL_CreateTextureFromSurface() function, however it returns a NULL texture and the error returned is "Invalid renderer".
The renderer was created successfully, I did test what it could be putting…

Troloze
- 23
- 8
0
votes
1 answer
SDL2: IMG_Load() - Segmentation fault on Raspberry Pi
This simple code that perfectly works on Ubuntu crashes with a segmentation fault on my Raspberry Pi v3:
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
int main()
{
char* artworkPath = "./testfile.png";
if…

Francesco
- 523
- 4
- 25
0
votes
0 answers
Failing to load a png image in SDL2
I am trying to load PNG image, but it always ends in an error. I was first trying to use SDL's SDL_LoadBMP, but since that dind't work, I downloaded SDL2_image.h, did all the setup, but it still isn't working. The image is in the same directory as…
user12291970
0
votes
0 answers
gcc can't find SDL_image
I have a code that I found on github:
#include
#include
#include
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "exit.png"
int main (int argc, char *argv[]) {
SDL_Window *win = NULL;
…

vapandris
- 27
- 5
0
votes
1 answer
SDL2_image rendering - Images render properly only when source SDL_Rect's properties are printed
My C++/SDL2 program uses a Sprites class with a std::map of pointers to SDL_Textures and member functions for loading and rendering images, however when the program ran none of the loaded images showed up in the window.
I've found that the Sprites…

Fazeli
- 3
- 2
0
votes
0 answers
SDL_Image loading a png returns nullptr
Alright so I'm trying to make a game engine for myself, and I've decided that it would be best to start loading images as files other than bitmaps using the SDL Image library. I've set up the library correctly according to conversations online,…
user12947832