IMG_SavePNG(3)

🌸 NAME 🌸

IMG_SavePNG(3) β€” the lil function that saves an SDL_Surface into a PNG image file. She’s from the SDL_image3 FUNCTIONS corner of the manual, and she’s here to help you save your pixels, bestie. πŸ’–

✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

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

πŸŽ€ DESCRIPTION πŸŽ€

okay so real talk: if the file already exists, it will be overwritten. That’s the whole vibe. No cap. πŸ’…

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • surface β€” the SDL surface to save. This is the pixel situation you’re sending off into the world. 🫢
  • file β€” the path on the filesystem to write the new file to. Literally where your PNG is gonna live. 🏑✨

⭐ RETURN VALUE ⭐

Returns true on success or false on failure. If it fails, call SDL_GetError() for more information β€” she’ll tell you what went wrong, iykyk. πŸ˜­πŸ”

🌈 AVAILABILITY 🌈

This function is available since SDL_image 3.0.0. Iconic behavior from day one, periodt. πŸ‘‘

πŸ’œ SEE ALSO πŸ’œ

  • IMG_SavePNG_IO(3) β€” the related function, go give her a read too. πŸ§šβ€β™€οΈ

This cute lil page is from SDL_image 3.4.4 β€” mwah, go save some PNGs bestie πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from