IMG_isWEBP(3)

πŸ’… IMG_isWEBP(3) β€” like, the WEBP detector bestie πŸ’–

okay so real quick: this is a page from SDL_image3 FUNCTIONS and the star of the show is IMG_isWEBP. yes she's a function. yes she's iconic. let's get into it ✨


πŸ¦‹ NAME πŸ¦‹

IMG_isWEBP β€” she peeks at a readable/seekable SDL_IOStream and is like "hmm… is this WEBP data?" and tells you. that's it. that's her whole job πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3_image/SDL_image.h>

bool IMG_isWEBP(SDL_IOStream *src);

look at her. one param. one bool. main character energy fr fr πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so basically this function attempts to determine if a file is a given filetype, and the way it does that is by reading the least amount possible from the SDL_IOStream β€” usually just a few bytes. lowkey respectful of your bandwidth ngl 🫢

⚠️ important vibe check: there is no distinction made between "not the filetype in question" and basic i/o errors. like, she does NOT snitch on which one it was. both just come back as a no. 😭

also bestie, she will always attempt to seek src back to where it started when this function was called β€” but she will not report any errors in doing so. so assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking. slay, rewinding queen πŸ’…

and like β€” 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 she's convenient, not mandatory. she's giving ✨optional luxury✨ not ✨mandatory homework✨


πŸ“ FUNCTION PARAMETERS πŸ“

  • src β€” a seekable/readable SDL_IOStream to provide image data. that's the snack she's inspecting 🧚

🌈 RETURN VALUE 🌈

Returns true if this is WEBP data, false otherwise. literally that simple, no cap πŸ’€


⭐ AVAILABILITY ⭐

This function is available since SDL_image 3.0.0. been here since day one, an absolute veteran πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€

the whole isTYPE friend group, all of them, no one left out πŸ’œ:


okay that's the whole page!! mwah πŸ’‹ go detect some webp files, bestie. this manual page comes to you courtesy of SDL_image, version SDL_image 3.4.4 β€” periodt, that's the source and the version, we stan a documented release πŸŒŸπŸ’…πŸ¦‹

πŸ“¦ where this page comes from