IMG_Save(3)

πŸ“¦
version 3.4.8 Β· 5 versions
, in fedora 43, fedora 44

πŸ’Ύ IMG_Save(3) β€” the SDL_image3 glow-up where ur surface becomes a whole file πŸ’…

okay bestie, listen. this is the manual page for IMG_Save, straight outta the SDL_image3 FUNCTIONS collection. it's the one that takes ur precious little SDL_Surface and yeets it onto the disk as a real image file. iconic behaviour, no notes. ✨


πŸŽ€ NAME πŸŽ€

IMG_Save β€” save an SDL_Surface into an image file. that's it, that's the job, and she does it flawlessly. 🫢


🌸 SYNOPSIS 🌸

#include <SDL3_image/SDL_image.h>

bool IMG_Save(SDL_Surface *surface, const char *file);

two args, one bool, zero drama. 😌


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea, and it's important tea:

  • if the file already exists, it will be overwritten. like, gone. replaced. not asked, not consulted, just overwritten. so pls be careful out there bestie, ok?? 😭
  • for formats that accept a quality setting, a default quality of 90 will be used. so if u don't specify, u get 90, which is genuinely a pretty good vibe. πŸ’…

πŸ“ FUNCTION PARAMETERS πŸ“

  • surface β€” the SDL_Surface u wanna save. this is ur main character. πŸ‘‘
  • file β€” path on the filesystem to write the new file to. yes, a real path, on a real filesystem, bestie. πŸ—‚οΈ

⭐ RETURN VALUE ⭐

returns true on success, or false on failure. and if it fails? call SDL_GetError() for more info, because she will tell u what went wrong. not me checking the return value every single time... πŸ™ˆ


🌈 AVAILABILITY 🌈

this function is available since SDL_image 3.4.0. so if ur on anything older, u simply cannot sit with us. sorry babes. πŸ’€


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, in order:

each one is a lil specialist for a specific format and honestly? we love range. 🧚


and that's the whole page, bestie!! mwah πŸ’– this was SDL_image version 3.4.8, from the good people who bring u SDL_image β€” go forth and save ur surfaces, and remember to check that bool. periodt. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from