---
name: "IMG_SavePNG"
section: "3"
platform: "linux"
package: "libsdl3-image-doc"
version: "3.2.4+ds-1+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/IMG_SavePNG"
---

# IMG\_SavePNG(3)

Save an SDL\_Surface into a PNG image file.

## NAME

IMG\_SavePNG - Save an SDL\_Surface into a PNG image file.

## HEADER FILE

Defined in SDL3\_image/SDL\_image.h

## SYNOPSIS

```
#include "SDL3_image/SDL_image.h"
```

**bool IMG\_SavePNG(SDL\_Surface \*surface, const char \*file);**

## DESCRIPTION

If the file already exists, it will be overwritten.

## FUNCTION PARAMETERS

- *surface*

  the SDL surface to save.

- *file*

  path on the filesystem to write new file to.

## RETURN VALUE

Returns true on success or false on failure; call SDL\_GetError() for more information.

## AVAILABILITY

This function is available since SDL\_image 3.0.0.

## SEE ALSO

**•**(3), [**IMG\_SavePNG\_IO**(3)](/IMG_SavePNG_IO/3.md)
