.\" 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_Init: .\" https://wiki.libsdl.org/SDL_image/IMG_Init .\" 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_Init .\" 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_Init 3 "SDL_image 3.0.0" "SDL_image" "SDL_image3 FUNCTIONS" .SH NAME IMG_Init \- Initialize SDL_image\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3_image/SDL_image.h\(dq .PP .BI "int IMG_Init(int flags); .fi .SH DESCRIPTION This function loads dynamic libraries that SDL_image needs, and prepares them for use\[char46] This must be the first function you call in SDL_image, and if it fails you should not continue with the library\[char46] Flags should be one or more flags from .BR IMG_InitFlags OR'd together\[char46] It returns the flags successfully initialized, or 0 on failure\[char46] Currently, these flags are: \(bu .BR .BR IMG_INIT_JPG \(bu .BR .BR IMG_INIT_PNG \(bu .BR .BR IMG_INIT_TIF \(bu .BR .BR IMG_INIT_WEBP \(bu .BR .BR IMG_INIT_JXL \(bu .BR .BR IMG_INIT_AVIF More flags may be added in a future SDL_image release\[char46] This function may need to load external shared libraries to support various codecs, which means this function can fail to initialize that support on an otherwise-reasonable system if the library isn't available; this is not just a question of exceptional circumstances like running out of memory at startup! Note that you may call this function more than once to initialize with additional flags\[char46] The return value will reflect both new flags that successfully initialized, and also include flags that had previously been initialized as well\[char46] As this will return previously-initialized flags, it's legal to call this with zero (no flags set)\[char46] This is a safe no-op that can be used to query the current initialization state without changing it at all\[char46] Since this returns previously-initialized flags as well as new ones, and you can call this with zero, you should not check for a zero return value to determine an error condition\[char46] Instead, you should check to make sure all the flags you require are set in the return value\[char46] If you have a game with data in a specific format, this might be a fatal error\[char46] If you're a generic image displaying app, perhaps you are fine with only having JPG and PNG support and can live without WEBP, even if you request support for everything\[char46] Unlike other SDL satellite libraries, calls to .BR IMG_Init do not stack; a single call to .BR IMG_Quit () will deinitialize everything and does not have to be paired with a matching .BR IMG_Init call\[char46] For that reason, it's considered best practices to have a single .BR IMG_Init and .BR IMG_Quit call in your program\[char46] While this isn't required, be aware of the risks of deviating from that behavior\[char46] After initializing SDL_image, the app may begin to load images into SDL_Surfaces or SDL_Textures\[char46] .SH FUNCTION PARAMETERS .TP .I flags initialization flags, OR'd together\[char46] .SH RETURN VALUE Returns all currently initialized flags\[char46] .SH AVAILABILITY This function is available since SDL_image 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR IMG_Quit (3)