This recipe will show you how to load images from various file formats. SDL_image supports the file formats BMP, CUR, GIF, ICO, JPG, LBM, PCX, PNG, PNM, TGA, TIF, XCF, XPM, and XV. SDL_image is a part of the LuaSDL module.
All images are loaded into the new surface object. File formats with support for transparent pixels (it's not the same as the alpha channel) would have set the color key attribute on the surface.
The SDL_image library depends on third-party libraries to load JPEG and PNG files. Make sure that you have the libjpeg, libpng, and zlib libraries installed. SDL_image doesn't require any additional initialization. LuaSDL handles this internally.