Mnemonic RasterImage library
General Info

Introduction
Screenshots
Mailing Lists and IRC
Alternative Browsers
Special Thanks

FAQ
Understanding Mnemonic
TODO list and ideas
Bug Reports


User Info

Download binaries
Platforms
Compiling Mnemonic
Other useful software


Developer Info

Core
Message modules
Library modules
Object modules
Coding Guidelines
Browse Source
Using CVS


View with any browser

Website questions to:
webmaster@mnemonic.org

Mnemonic questions to:
disc@mnemonic.org

 

C++ library to read/write bitmapped images

The rasterimage library is a very small C++ library to read (and later: write) images stored in bitmapped format, eg. JPEG, GIF, PNG, XPM and so on. It uses standard C++ streams for input/output and handles progressive updates. It relies on several existing C libraries to do the hard work of converting the stream of data into an image; the rasterimage library is only intended as a wrapper class to unify the treatment of various image types and give them a proper C++ interface.

Unlike other libraries, this one is pure C++, using the standard library and STL. It is not tied to a particular user interface toolkit (like GTK or QT) since images have nothing to do with user interfaces per se.

It supports alpha channels (can combine two images or one image and one solid color using alpha channel info) and has optimised internal data formats for various color depths. It does not do any fancy image manipulation.

Using the rasterimage classes

The main class rasterimage can be fed any stream of data that represents an image and all of the decoding will be handled automatically. So you can do

rasterimage myimg;
fstream     mystr("image.jpg");
char        buffer[1024];
long        length;

while((length=mystr.read(buffer,1024))) {
   myimg.write(buffer,length);
   }

The other things you need

You need all of these support libraries; there is no way to build lib-rasterimage with only a subset of these, sorry.

  • libjpg for JPEG images,
  • libungif (preferably version 4.1.0 or later) for GIF images,
  • libpng (developed with 1.0.3 or later) for PNG images. You also need zlib.
  • libtiff for TIFF images.