---
name: "IMG_SaveJPG"
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_SaveJPG"
---

# IMG\_SaveJPG(3)

Save an SDL\_Surface into a JPEG image file.

## NAME

IMG\_SaveJPG - Save an SDL\_Surface into a JPEG image file.

## HEADER FILE

Defined in SDL3\_image/SDL\_image.h

## SYNOPSIS

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

**bool IMG\_SaveJPG(SDL\_Surface \*surface, const char \*file, int quality);**

## 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.

- *quality*

  \[0; 33\] is Lowest quality, \[34; 66\] is Middle quality, \[67; 100\] is Highest quality.

## 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\_SaveJPG\_IO**(3)](/IMG_SaveJPG_IO/3.md)
