Skip to content

Commit 70dad26

Browse files
committed
Save lossy formats at 90% quality by default
1 parent 284996b commit 70dad26

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/SDL3_image/SDL_image.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArrayToRGB888(char **xp
18531853
*
18541854
* If the file already exists, it will be overwritten.
18551855
*
1856-
* For formats that accept a quality, a default quality of 75 will be used.
1856+
* For formats that accept a quality, a default quality of 90 will be used.
18571857
*
18581858
* \param surface the SDL surface to save.
18591859
* \param file path on the filesystem to write new file to.
@@ -1881,7 +1881,7 @@ extern SDL_DECLSPEC bool SDLCALL IMG_Save(SDL_Surface *surface, const char *file
18811881
* If `closeio` is true, `dst` will be closed before returning, whether this
18821882
* function succeeds or not.
18831883
*
1884-
* For formats that accept a quality, a default quality of 75 will be used.
1884+
* For formats that accept a quality, a default quality of 90 will be used.
18851885
*
18861886
* \param surface the SDL surface to save.
18871887
* \param dst the SDL_IOStream to save the image data to.

src/IMG.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,20 +386,20 @@ bool IMG_SaveTyped_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio, con
386386
}
387387

388388
if (SDL_strcasecmp(type, "avif") == 0) {
389-
result = IMG_SaveAVIF_IO(surface, dst, false, 75);
389+
result = IMG_SaveAVIF_IO(surface, dst, false, 90);
390390
} else if (SDL_strcasecmp(type, "bmp") == 0) {
391391
result = IMG_SaveBMP_IO(surface, dst, false);
392392
} else if (SDL_strcasecmp(type, "gif") == 0) {
393393
result = IMG_SaveGIF_IO(surface, dst, false);
394394
} else if (SDL_strcasecmp(type, "jpg") == 0 ||
395395
SDL_strcasecmp(type, "jpeg") == 0) {
396-
result = IMG_SaveJPG_IO(surface, dst, false, 75);
396+
result = IMG_SaveJPG_IO(surface, dst, false, 90);
397397
} else if (SDL_strcasecmp(type, "png") == 0) {
398398
result = IMG_SavePNG_IO(surface, dst, false);
399399
} else if (SDL_strcasecmp(type, "tga") == 0) {
400400
result = IMG_SaveTGA_IO(surface, dst, false);
401401
} else if (SDL_strcasecmp(type, "webp") == 0) {
402-
result = IMG_SaveWEBP_IO(surface, dst, false, 75.0f);
402+
result = IMG_SaveWEBP_IO(surface, dst, false, 90.0f);
403403
} else {
404404
result = SDL_SetError("Unsupported image format");
405405
}

0 commit comments

Comments
 (0)