Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

209.3. sdl2-image-2.8.12

Load PNG, JPEG, WebP, AVIF, JPEG XL, TIFF, SVG and older formats into SDL2 surfaces

2.8.12-1 · Zlib · 0.1 SBU · 269.1 KiB, 14 files · 42_graphics, 92 of 189 · ports/core/game-libs/sdl2-image

Homepage: https://github.com/libsdl-org/SDL_image

Why it is in KDOS. The comment above the 9 ports from sdl2-image to sdl3-ttf in script/phases/42_graphics/packages.d/game-libs.txt:

The SDL satellites for SDL 2 and SDL 3. There is no sdl2-config: a build that asks for it is given pkg-config sdl2, and an SDL 2 program runs on SDL 3 through sdl2-compat.

SDL2_image loads image files into SDL 2 surfaces and textures: PNG, JPEG, WebP, AVIF, JPEG XL, TIFF and SVG, plus the older formats it decodes itself (BMP, GIF, LBM, PCX, PNM, QOI, TGA, XCF, XPM and XV). It is built against sdl2-compat, so the SDL 2 programs that use it run on sdl3. Every format that takes an outside library is named on, and each of those libraries is linked rather than loaded at run time.

Depends on: cmake, ninja, pkgconf, sdl2-compat, libjpeg-turbo, libpng, libtiff, libwebp, libavif, libjxl, zlib.

Required by (18): brogue-ce, cataclysm-dda, crawl-tiles, devilutionx, dosbox-staging, dsda-doom, fheroes2, flare-engine, freeciv, grafx2, pioneer, python3-kivy, sauerbraten, supertux, tuxpaint, vice, wesnoth, widelands.

Sources: sdl2-image-2.8.12.tar.gz (6.6 MiB). Every step kpkg takes applies to this port.

Install: script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install sdl2-image'

build.sh:

mkdir -p build && cd build
cmake .. -G Ninja \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DBUILD_SHARED_LIBS=ON \
	-DSDL2IMAGE_VENDORED=OFF \
	-DSDL2IMAGE_STRICT=ON \
	-DSDL2IMAGE_DEPS_SHARED=OFF \
	-DSDL2IMAGE_BACKEND_STB=OFF \
	-DSDL2IMAGE_SAMPLES=OFF \
	-DSDL2IMAGE_TESTS=OFF \
	-DSDL2IMAGE_AVIF=ON \
	-DSDL2IMAGE_JPG=ON \
	-DSDL2IMAGE_JXL=ON \
	-DSDL2IMAGE_PNG=ON \
	-DSDL2IMAGE_TIF=ON \
	-DSDL2IMAGE_WEBP=ON \
	-DSDL2IMAGE_SVG=ON
ninja
DESTDIR=$PKG ninja install

Libraries: libSDL2_image-2.0.so, libSDL2_image.so.

Directories: /usr/lib/cmake/SDL2_image, /usr/share/licenses/SDL2_image, /usr/share/licenses/sdl2-image.

The formats left at their defaults (BMP, GIF, LBM, PCX, PNM, QOI, TGA, XCF, XPM, XV) are decoded by SDL2_image’s own code and need no library. sdl3-image is the SDL 3 counterpart, built the same way.