views:

2955

answers:

6
+2  Q: 

C Image Library

Can anyone recommend a decent C image library?

I'm after loaders for bmp, gif, jpg, png and tga.

I want to use this for programming my Sony Playstation Portable, so opensource would be very handy.

After some googleing I've found FreeImage and CImg, but both feel rather heavy, and CImg is C++ not C.

Cheers

thing2k

+8  A: 

ImageMagick has a C API to connect to its libraries. There's also what they call a "low-level interface" between C and the ImageMagick libraries.

Thomas Owens
But how portable is it for the PSP.
thing2k
+1  A: 

DevIL is often recommended. Whether or not it does what you want, I don't know.

Bernard
+1  A: 

I used FreeImage for PSP games in the past, but it was for pre-processing the data rather than in-game.

Jim Buck
+2  A: 

I will second Thomas Owens's ImageMagick suggestion. It is mind-boggling just how comprehensive the library is, and how much time it saves you in the end.

shea241
A: 

Here is some code I wrote for handling images. It is in c++ ( not c ) but you should be able to easily extract the BMP and GIF load code. It's licensed LGPL.

I use the libpng and jpeglib for decompressing those formats.

KPexEA
+3  A: 

If you control the images you're loading, the lightest loader I know is Sean Barrett's awesome stb_image.c (direct link to single file source code!).

There are also other very worthwhile libraries on Sean's site such as a tiny TrueType rasterizer and Vorbis decompressor, btw.

If you need OpenGL image loading that uses stb_image, I'll humbly point you to SOILex...

AKX