IMG_isGIF(3)
π NAME π
okay bestie, welcome to IMG_isGIF(3) from the SDL_image3 FUNCTIONS manual β this is the function that detects GIF image data on a readable/seekable SDL_IOStream. It's a tiny filetype vibe check, and honestly she ate. π
β¨ SYNOPSIS β¨
#include <SDL3_image/SDL_image.h>
bool IMG_isGIF(SDL_IOStream *src);
That's the whole signature, no cap. π
π¦ DESCRIPTION π¦
So IMG_isGIF attempts to determine if a file is a given filetype β in this case GIF β and it reads the least amount possible from the SDL_IOStream, usually just a few bytes. Literally the smallest lil sniff. πβ¨
There is no distinction made between "not the filetype in question" and basic i/o errors. Translation: if it comes back false, it is not telling you whether this is simply not GIF data or whether something basic on the i/o side went wrong β same answer, same false. π
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so. Assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking. So she rewinds the stream for you and just doesn't make a whole thing of it. Iconic behavior, fr fr. π«Ά
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions. So consider this a bonus vibe check, not a required step in the loading pipeline. β
π FUNCTION PARAMETERS π
srcβ a seekable/readableSDL_IOStreamto provide image data. One stream, bestie, that's the whole parameter. π
π RETURN VALUE π
Returns true if this is GIF data, false otherwise. Binary baddie behavior β she's not doing maybes. π
π AVAILABILITY π
This function is available since SDL_image 3.0.0. If your version is older than that, she is not in the group chat yet. π°οΈ
π₯ SEE ALSO π₯
The other IMG_isTYPE besties, all listed exactly as the page says:
IMG_isANI(3)IMG_isAVIF(3)IMG_isBMP(3)IMG_isCUR(3)IMG_isICO(3)IMG_isJPG(3)IMG_isJXL(3)IMG_isLBM(3)IMG_isPCX(3)IMG_isPNG(3)IMG_isPNM(3)IMG_isQOI(3)IMG_isSVG(3)IMG_isTIF(3)IMG_isWEBP(3)IMG_isXCF(3)IMG_isXPM(3)IMG_isXV(3)
Sign-off time: this page comes from SDL_image, version SDL_image 3.4.4, per the footer. No date is stamped on this footer, so I'm not inventing one β just serving the version realness. ππ«Άπ
π¦ where this page comes from
- ubuntu stonking: libsdl3-image-doc 3.4.4+ds-2 Β· zlib/libpng AND HPND-like AND zlib-like-permissive
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms