Hello. I have been looking long and hard for an image library that meets these criteria that I have for pretty much any library I will use (with some obvious exceptions):

A) Cross-Platform (If at all possible)
B) Weightless (or nearly weightless)
C) Stand-alone (I hate having to include DLLs in my projects, SLLs are fine though)
D) Relatively Simple
E) Standards complient (If there are standards for image loading?)
F) Long-lasting (I hate when I have code that I have to re-write tons of code because a library I used ceases to be supported. [Of course I use modularization to make it relatively easy, it just annoys me])
G) Documented (Even rudimentally is fine)

I want this library to be able to load as many image types as possible and store them in some kind of relatively easy to manipulate array, then allow me to save the data afterwards. Basically I don't want to have to deal with decompressing all the assorted compressed file formats. I will if I have to, but I am certain that somebody already has. Anyways, thanks in advance for any help. :)

Recommended Answers

All 2 Replies

CImg is one I often point people at. It's very easy to use; a single header file. It meets some of your needs very well, others less so, but by virtue of being a single header file it has a good stab at being cross-platform and not so reliant on you adding extra libraries and the like (although, frankly, some image formats like JPG are such a pain to handle that it's very common to make use of existing libraries on the system).

Interesting... reading the tutorial page it says "Note that you must also have installed the ImageMagick package in order to be able to read JPG images." I think I know what that means! So far CImg is a good candidate, especially since I intend to edit pixel-level data and jpegs really don't work well that way, but I am a picky person. I am going to keep looking. Any other suggestions? Actually just any way you could define this class is good for me as long as it is weightless and doesnt take extra files to be installed with your program:

#ifndef SOME_GUARD
#define SOME_GUARD
//no globals, otherwise it isnt weightless
typedef SomeType Colour;//yes I am canadian... u need the u!!!
enum ImageType
{
    Bitmap,
    JPEG,
    GIF,
    //etc...
};
template <ImageType T>
class Image
{ //private:
    //some stuff
    public:
    Image();//default constructor
    Image(const char *);//file-name constructor
    #ifdef _STDIO_H_
        Image(FILE *);//it definately has its uses! (that way you wouldn't have to keep re-opening files
    #endif
    #ifdef _GLIBCXX_FSTREAM
        Image(fstream &);
    #endif
    colour &operator()(int,int);//so you can go Img(x,y)
    void Save();
};//I would be adding a bit more, but this is all enough!
#endif
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.