SDL_Surface to SDL_image's RWops

Hi, it’s my second question of the day. Is there any function to convert
from SDL_Surface to a type of image RWops (like png, jpg, tga, gif, etc)?
Thanks.

Hi, it’s my second question of the day. Is there any function to convert
from SDL_Surface to a type of image RWops (like png, jpg, tga, gif, etc)?

SDL_image only reads these formats, but there are open source libraries
you can use to convert a memory buffer (such as surface->pixels) to any
of these formats, though.

Here’s one that glues all of them into one library that handles multiple
formats, like SDL_image does for reading:

http://freeimage.sourceforge.net/features.html

Coincidentally, FreeImage is what Google Earth uses for most of its
image processing on Windows, Linux and Mac OS X. In many cases, it’s
just a unified API over things like libpng, libjpeg-6b, libtiff, etc, so
if there’s a specific format you want, it might be more lightweight to
get one of the specific libraries.

I’m sure there are other libraries that do something similar to
freeimage, too.

–ryan.

Hi, it’s my second question of the day. Is there any function to convert
from SDL_Surface to a type of image RWops (like png, jpg, tga, gif,
etc)?

SDL_image only reads these formats, but there are open source libraries
you can use to convert a memory buffer (such as surface->pixels) to any
of these formats, though.

Here’s one that glues all of them into one library that handles multiple
formats, like SDL_image does for reading:

http://freeimage.sourceforge.net/features.html

Coincidentally, FreeImage is what Google Earth uses for most of its
image processing on Windows, Linux and Mac OS X. In many cases, it’s
just a unified API over things like libpng, libjpeg-6b, libtiff, etc, so
if there’s a specific format you want, it might be more lightweight to
get one of the specific libraries.

I’m sure there are other libraries that do something similar to
freeimage, too.

–ryan.

Thanks, I’ll try to have a look.