Skip to content

SDL2_image: use libjpeg and libpng instead of stb_image#462

Open
s09bQ5 wants to merge 1 commit into
flathub:masterfrom
s09bQ5:sdl2-image-no-stb
Open

SDL2_image: use libjpeg and libpng instead of stb_image#462
s09bQ5 wants to merge 1 commit into
flathub:masterfrom
s09bQ5:sdl2-image-no-stb

Conversation

@s09bQ5
Copy link
Copy Markdown

@s09bQ5 s09bQ5 commented May 10, 2026

stb_image is a public domain implementation of several image decoders in a single C header file. SDL2_image includes a copy of it and uses it by default for JPEG and PNG. A comment in stb_image says

"Primarily of interest to game developers and other people who can
avoid problematic images and only need the trivial interface"

Since the flatpak runtimes generally do include libjpeg and libpng, there is no reason to use a possibly limited implementation. It probably also receives less security testing than the de-facto standard libraries.

stb_image is a public domain implementation of several image decoders in
a single C header file. SDL2_image includes a copy of it and uses it by
default for JPEG and PNG. A comment in stb_image says

  "Primarily of interest to game developers and other people who can
   avoid problematic images and only need the trivial interface"

Since the flatpak runtimes generally do include libjpeg and libpng, there
is no reason to use a possibly limited implementation. It probably also
receives less security testing than the de-facto standard libraries.
@tothxa
Copy link
Copy Markdown
Collaborator

tothxa commented May 11, 2026

I don't really know what to think about this. Maybe I'm too old, but "limited implementation with trivial interface" sounds like the essence of security to me. (but I can't judge the actual code myself)

As for its limits: We use somewhat esoteric PNGs to save space (indexed colours with separate full alpha) that most image editors can't edit and save properly, but they work just fine with the current SDL2-image builds.

And SDL itself is "Primarily of interest to game developers". :)

@tothxa
Copy link
Copy Markdown
Collaborator

tothxa commented May 11, 2026

@s09bQ5 I've just read your linked comment. Have you tried building UltraStarDeluxe with including the current manifest? If so, are you aware of any actual image files that didn't work with that build?

@s09bQ5
Copy link
Copy Markdown
Author

s09bQ5 commented May 12, 2026

Our game requires users to add content, so we don't have any control over the images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants