IMG_isPNG(3)

πŸ’… NAME πŸ’…

hey bestie πŸ’– welcome to IMG_isPNG(3), a page from the SDL_image3 FUNCTIONS manual ✨

IMG_isPNG β€” detect PNG image data on a readable/seekable SDL_IOStream. no cap, that’s the whole assignment πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

bool IMG_isPNG(SDL_IOStream *src);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_IOStream β€” usually just a few bytes 🫢. it’s giving β€œquick peek, not a whole read-through” and honestly? iconic.

important bestie: there is no distinction made between β€œnot the filetype in question” and basic i/o errors 😭. so if it comes back false, it’s not telling you whether it’s β€œnope, not PNG” or β€œoops, i/o said no.” it simply said false and moved on πŸ’€.

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. but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking 🫢✨. very polite of it, 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 this is a vibe check, not a mandatory step πŸ’….


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • src β€” a seekable/readable SDL_IOStream to provide image data.

🌸 RETURN VALUE 🌸

Returns true if this is PNG data, false otherwise. periodt πŸ’–


⭐ AVAILABILITY ⭐

This function is available since SDL_image 3.0.0. yes bestie, she’s been around πŸ‘‘.


πŸ”₯ SEE ALSO πŸ”₯

go give these other cuties a read too:


mwah πŸ’‹ cute sign-off time: source SDL_image, version SDL_image 3.4.4, dated IMG_isPNG(3) β€” love her, no notes πŸŒˆπŸ¦‹

πŸ“¦ where this page comes from