參考資訊:
https://wiki.libsdl.org/FrontPage
main.c
#include <stdio.h> #include <stdlib.h> #include <SDL.h> #include <SDL_image.h> int main(int argc, char **argv) { SDL_Surface *png = IMG_Load("main.png"); IMG_SavePNG(png, "saved.png"); SDL_FreeSurface(png); SDL_Quit(); return 0; }
編譯
$ gcc main.c -o main -lSDL2 -lSDL2_image -I/usr/include/SDL2