Tutorial :Simple image loading libraries



Question:

I have an app that uses this library (actually a direct port to D) for some image processing. I'm looking for some other libraries of a similar style to use to load other file types.

Things I need/want:

  • Loss less format.
  • Simple C API.
  • Loads data into buffers in a raw pixel format.
  • Open source (as in I can get source files and compile them for my own use, aside from that, licensing doesn't matter)

Anyone know of anything like that?


Solution:1

devIL and SDL_Image supports a good deal of formats. Derelict provides their bindings.

My own code for using these and have a raw buffer:


Solution:2

PNG: for loading and saving you can try LodePNG library

C/C++: http://members.gamedev.net/lode/projects/LodePNG/

D port: www.dsource.org/projects/scrapple/wiki/LodePngLibrary


Solution:3

FreeImage is pretty comprehensive, and very clean and easy to use.

http://freeimage.sourceforge.net/


Solution:4

You might want to try libpng, although I wouldn't exactly call it easy to use.

Other than that, you might try working directly on bitmaps, with no libraries at all.


Solution:5

I'd consider using imageMagick ( http://www.imagemagick.org/script/index.php ) for all your image loading needs. It supports a lot of formats in a lot of different bit depths, reading and writing for most of them.

It may do a lot more than you need, but its a very well designed library and I've used it in several projects.

It is GPL compatible. (And I think commercial licenses are available too)


Solution:6

You could always try the gdimage library. I've never had any problems with it, though mist of the work I've done with it has been in PHP.


Solution:7

You can use software such as Netpbm to convert to/from PPM format, which is extremely easy to read/write from any program without needing external libraries.

A PPM file either looks like this:

  P6  800 600 255  # followed by 800x600x3 bytes of values between 0 and 255, i.e.  \xFF\x00\x00\x80\x80\x00\x00\xFF\x00\x00\x80\x80\x00\x00\xFF...  # but not escaped  

or like this:

  P3  800 600 255  # followed by 800x600x3 decimal numbers between 0 and 255, i.e.  255 0 0  128 128 0  0 255 0  0 128 128  0 0 255  ...  


Solution:8

I think SOIL (Simple OpenGl Image Library) fits your description nicely. It has many formats, iirc the jpg code is even ported from the same source as yours.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »