IMG_SaveWEBP(3)
πΎ 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β theSDL_Surfaceyou 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
- fedora 43: SDL3_image-devel 3.4.8-1.fc43 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- fedora 43: SDL3_image-devel 3.4.8-1.fc43 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- fedora 44: SDL3_image-devel 3.4.8-1.fc44 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- fedora 44: SDL3_image-devel 3.4.8-1.fc44 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms