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/readable SDL_IOStream to 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:


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