NAME
SDL3::Image - Image Loading support for SDL3
SYNOPSIS
use v5.40;
use SDL3 qw[:all :main];
use SDL3::Image qw[:all];
my $surface = IMG_Load('sprite.png');
die SDL_GetError() unless $surface;
# Or decode straight into a texture the renderer can draw
my $texture = IMG_LoadTexture( $renderer, 'background.jpg' );
DESCRIPTION
SDL3::Image binds a simple library to load images of various formats as SDL surfaces.
It can load BMP, GIF, JPEG, LBM, PCX, PNG, PNM (PPM/PGM/PBM), QOI, TGA, XCF, XPM, and simple SVG format images. It can also load AVIF, JPEG-XL, TIFF, and WebP images, depending on how the underlying library was built.
Decoded pixels are returned as an SDL_Surface (see SDL3) that you can blit, convert, or turn into a texture with SDL_CreateTextureFromSurface( ... ). When a renderer is already available, IMG_LoadTexture( ... ) uploads the pixels straight into an SDL_Texture. Every loader has an *_IO variant that reads from an SDL_IOStream, so images can be decoded from memory, a storage container, or any other stream.
Animated images (GIF, WebP, AVIF, ANI, ...) can be decoded frame by frame with an IMG_AnimationDecoder, and embedded metadata is exposed as SDL properties on the loaded surface or animation.
There are a few examples in this distribution's eg/image directory.
Features
Each feature listed below is a tag you may use.
:all - SDL3_image Functions
This binds all functions, defines all types, and imports them into your package.
See the SDL3_image Wiki for documentation of the functions and formats you will have access to with this import tag.
See Also
The project's repo: https://github.com/Perl-SDL3/
The SDL3_image Wiki: https://wiki.libsdl.org/SDL3_image/FrontPage
LICENSE
This software is Copyright (c) 2026 by Sanko Robinson.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
See the LICENSE file for full text.
AUTHOR
Sanko Robinson https://github.com/sanko