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 givenpkg-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
-DSDL2IMAGE_VENDORED=OFF— Builds against the libraries in the root rather than upstream’s own copies of them, which are git submodules thatexternal/download.shfetches and the release tarball does not contain. This is upstream’s default everywhere but MSVC, named here.-DSDL2IMAGE_STRICT=ON— Stops configure when a library a named format needs is missing. Upstream’s default is off, and a missing library then builds the library without that format.-DSDL2IMAGE_DEPS_SHARED=OFF— Links each codec library. Upstream’s default loads each one withdlopenat run time instead; a dlopened library is a dependency the package solver cannot see, and a missing one is a format that silently stops loading; a linked one is aNEEDEDentry.-DSDL2IMAGE_BACKEND_STB=OFF— Decodes PNG and JPEG with libpng and libjpeg-turbo instead of thestb_imagecode compiled into the library, which upstream uses by default: a private decoder that no libjpeg-turbo or libpng update reaches.-DSDL2IMAGE_AVIF=ON,-DSDL2IMAGE_JPG=ON,-DSDL2IMAGE_PNG=ON,-DSDL2IMAGE_TIF=ON,-DSDL2IMAGE_WEBP=ON— Formats upstream builds by default, named so thatSTRICTholds them to libavif, libjpeg-turbo, libpng, libtiff and libwebp.-DSDL2IMAGE_JXL=ON— JPEG XL through libjxl. Upstream’s default is off.-DSDL2IMAGE_SVG=ON— SVG, rasterised by the nanosvg code compiled into the library; it takes no outside library.-DSDL2IMAGE_SAMPLES=OFF,-DSDL2IMAGE_TESTS=OFF— Builds neither the sample programs, which upstream builds by default when SDL2_image is the top-level project, nor the unit tests, which are off by default.
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.