.\" This manpage content is licensed under Creative Commons .\" Attribution 4.0 International (CC BY 4.0) .\" https://creativecommons.org/licenses/by/4.0/ .\" This manpage was generated from SDL_image's wiki page for IMG_Load: .\" https://wiki.libsdl.org/SDL_image/IMG_Load .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision 3~git20240319~18b2816+ds-1 .\" Please report issues in this manpage's content at: .\" https://github.com/libsdl-org/sdlwiki/issues/new .\" Please report issues in the generation of this manpage from the wiki at: .\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20IMG_Load .\" SDL_image can be found at https://libsdl.org/projects/SDL_image .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH IMG_Load 3 "SDL_image 3.0.0" "SDL_image" "SDL_image3 FUNCTIONS" .SH NAME IMG_Load \- Load an image from a filesystem path into a software surface\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3_image/SDL_image.h\(dq .PP .BI "SDL_Surface * IMG_Load(const char *file); .fi .SH DESCRIPTION An SDL_Surface is a buffer of pixels in memory accessible by the CPU\[char46] Use this if you plan to hand the data to something else or manipulate it further in code\[char46] There are no guarantees about what format the new SDL_Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one)\[char46] You can inspect an SDL_Surface for its specifics, and use SDL_ConvertSurface to then migrate to any supported format\[char46] If the image format supports a transparent pixel, SDL will set the colorkey for the surface\[char46] You can enable RLE acceleration on the surface afterwards by calling: SDL_SetSurfaceColorKey(image, SDL_RLEACCEL, image->format->colorkey); There is a separate function to read files from an SDL_IOStream, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function is .BR IMG_Load_IO ()\[char46] If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an SDL_Texture for use by the GPU without using a software surface: call .BR IMG_LoadTexture () instead\[char46] When done with the returned surface, the app should dispose of it with a call to SDL_DestroySurface()\[char46] .SH FUNCTION PARAMETERS .TP .I file a path on the filesystem to load an image from\[char46] .SH RETURN VALUE Returns a new SDL surface, or NULL on error\[char46] .SH AVAILABILITY This function is available since SDL_image 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR IMG_LoadTyped_IO (3), .BR IMG_Load_IO (3), .BR SDL_DestroySurface (3)