IMG_SaveWEBP(3)

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

πŸ’Ύ IMG_SaveWEBP β€” the SDL_image glow-up for your surfaces

okay bestie, welcome to the SDL_image corner of the manual πŸ’– this one's from the SDL_image 3 functions, and it's literally the moment your SDL_Surface gets to become a whole WEBP file. no cap.


✨ NAME ✨

IMG_SaveWEBP β€” save an SDL_Surface into a WEBP image file. yes, that's the whole job. slay. πŸ’…


✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

bool IMG_SaveWEBP(SDL_Surface *surface, const char *file, float quality);

look at her. three little args and she's done. iconic. πŸŽ€


✨ DESCRIPTION ✨

so basically you hand her a surface and a path and she writes your WEBP out. that's it, that's the vibe.

⚠️ heads up bestie: if the file already exists, it will be overwritten. not merged, not appended, not asked-about. just gone, replaced by your new art. so like… double-check that filename before you commit, fr fr. πŸ™ˆ

✨ FUNCTION PARAMETERS ✨

  • surface β€” the SDL_Surface you wanna save. your main character. πŸ‘‘
  • file β€” the path on the filesystem where the new file gets written. point her at the right folder, please. πŸ“
  • quality β€” a number between 0 and 100. and here's the tea, because she means two different things depending on your mode:
    • for lossy: 0 gives the smallest size, 100 gives the largest.
    • for lossless: this parameter is the amount of effort put into the compression. 0 is the fastest but gives larger files, compared to the slowest, but best, 100.

so like, 0 is "idc just go" and 100 is "I have time and I want it perfect". both valid. 🌸


✨ RETURN VALUE ✨

returns true on success or false on failure 🫢 β€” and if it's a false moment, call SDL_GetError() for more information. she'll tell you what went wrong, she's not mysterious.


✨ AVAILABILITY ✨

this function is available since SDL_image 3.4.0. so if you're on anything older… yeah, no. upgrade era. ⭐


✨ SEE ALSO ✨

  • IMG_SaveWEBP_IO(3) β€” the sibling who works with an IO stream instead of a path. same energy, different door. πŸ¦‹

okay that's the whole page bestie, go forth and save some WEBPs πŸ’–βœ¨

this was brought to you by SDL_image, version 3.4.8 β€” mwah, bye πŸ’…πŸŒˆ

πŸ“¦ where this page comes from