IMG_isJPG(3)
π NAME π
IMG_isJPG β bestie, this is the little icon that peeks at your image data and is like "yeah that's a JPG, I can tell" β specifically it detects JPG image data on a readable/seekable SDL_IOStream. π
Oh and hey, this whole page lives in the SDL_image3 functions squad, and the star of the show is IMG_isJPG(3) itself. Hiii. π«Ά
β¨ SYNOPSIS β¨
#include <SDL3_image/SDL_image.h>
bool IMG_isJPG(SDL_IOStream *src);
π¦ DESCRIPTION π¦
Okay so here's the vibe: this function tries to figure out if a file is a given filetype, and it reads the least amount possible from the SDL_IOStream β usually just a few bytes. Lowkey the politeness of it all. π
Heads up: there is no distinction made between "not the filetype in question" and basic i/o errors. So like, if it says no, it might just be having a rough day. Both outcomes look identical, no cap. π
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. Iconic behavior honestly. β¨
And bestie, 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 more of a "just checking π" situation than a requirement. π§
π FUNCTION PARAMETERS π
srcβ a seekable/readableSDL_IOStreamto provide image data. That's the whole thing. Give it your stream, it does its little sniff test. π
β RETURN VALUE β
Returns true if this is JPG data, false otherwise. Slay either way, honestly. π₯
πΈ AVAILABILITY πΈ
This function is available since SDL_image 3.0.0. So if you're on anything olderβ¦ girl. Time for an upgrade. π
π SEE ALSO π
The whole detection family reunion, all of them, no one left out: IMG_isANI(3), IMG_isAVIF(3), IMG_isBMP(3), IMG_isCUR(3), IMG_isGIF(3), IMG_isICO(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). Collect them all like stickers. π
And that's the page, bestie β brought to you by SDL_image 3.4.4 (the SDL_image source, version 3.4.4, per the footer of IMG_isJPG(3)). Go forth and detect some JPGs. Mwah. π
π¦ 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