• Stars
    star
    527
  • Rank 84,091 (Top 2 %)
  • Language
    C
  • License
    zlib License
  • Created almost 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Image decoding for many popular formats for Simple Directmedia Layer.
SDL_image 3.0

The latest version of this library is available from GitHub:
https://github.com/libsdl-org/SDL_image/releases

This is 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 build options (see the note below for details.)

API:
#include <SDL3_image/SDL_image.h>

	SDL_Surface *IMG_Load(const char *file);
or
	SDL_Surface *IMG_Load_RW(SDL_RWops *src, SDL_bool freesrc);
or
	SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, SDL_bool freesrc, char *type);

where type is a string specifying the format (i.e. "PNG" or "pcx").
Note that IMG_Load_RW cannot load TGA images.

To create a surface from an XPM image included in C source, use:

	SDL_Surface *IMG_ReadXPMFromArray(char **xpm);

An example program 'showimage' is included, with source in examples/showimage.c

Documentation is also available online at https://wiki.libsdl.org/SDL_image

This library is under the zlib License, see the file "LICENSE.txt" for details.

Note:
Support for AVIF, JPEG-XL, TIFF, and WebP are not included by default because of the size of the decode libraries, but you can get them by running external/download.sh
- When building with CMake, you can enable the appropriate SDL3IMAGE_* options defined in CMakeLists.txt. SDL3IMAGE_VENDORED allows switching between system and vendored libraries.
- When building with configure/make, you can build and install them normally and the configure script will detect and use them.
- When building with Visual Studio, you will need to build the libraries and then add the appropriate LOAD_* preprocessor define to the Visual Studio project.
- When building with Xcode, you can edit the config at the top of the project to enable them, and you will need to include the appropriate framework in your application.
- For Android, you can edit the config at the top of Android.mk to enable them.

More Repositories

1

SDL

Simple Directmedia Layer
C
9,731
star
2

SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
C
391
star
3

SDL_ttf

Support for TrueType (.ttf) font files with Simple Directmedia Layer.
C
358
star
4

sdl12-compat

An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
C
192
star
5

SDL_net

A simple, cross-platform wrapper over TCP/IP sockets.
Perl
190
star
6

SDL_shader_tools

Shader compiler and tools for SDLSL (Simple Directmedia Layer Shader Language)
C
146
star
7

SDL-1.2

Simple Directmedia Layer, 1.2 branch ... ***DEPRECATED***, please use https://github.com/libsdl-org/SDL for new projects!
C
96
star
8

sdlwiki

This is the raw contents of SDL's wiki. You can edit this through GitHub or at https://wiki.libsdl.org/ now!
78
star
9

sdl2-compat

An SDL2 compatibility layer that uses SDL3 behind the scenes.
C
71
star
10

SDL_rtf

Support for Rich Text Format (.rtf) files with Simple Directmedia Layer.
Perl
38
star
11

SDL_gpu_shadercross

Single-file header to support SPIR-V and HLSL on various backends
C
38
star
12

ghwikipp

A slight improvement on GitHub's current wiki support.
PHP
28
star
13

setup-sdl

GitHub action for providing SDL.
JavaScript
23
star
14

SDL_gesture

SDL2's gesture API split out into a single-header library.
C
19
star
15

libtiff

TIFF decoding library from https://gitlab.com/libtiff/libtiff
C
17
star
16

Maelstrom

Maelstrom 3.0
C++
13
star
17

GUIlib

Simple (and unmaintained!) GUI library built on SDL. Not recommended for new code!
Shell
12
star
18

sdlweb

The website for Simple Directmedia Layer.
PHP
12
star
19

SDL-historical-archive

This is a snapshot of SDL's complete Mercurial repository when we migrated to GitHub. This is is just for historical purposes.
C
8
star
20

SDL_helloworld

A Hello World project that uses SDL.
C
7
star
21

jpeg

JPEG decoding library from https://www.ijg.org/
C
6
star
22

mpg123

mpg decoding library from http://mpg123.de/
C
5
star
23

aom

AV1 Codec Library, forked from https://aomedia.googlesource.com/aom/
C
2
star