EasyBMP C++ Bitmap Library

About EasyBMP

Project Goals

EasyBMP is a library by a novice programmer for novice programmers. Every part of its design kept ease of installation and use in mind. Some desired features include:

  1. No installation required: Because bitmap I/O is so simple, the library should not require any installation process. EasyBMP attains this goal by only requiring that the header files and a single C++ file be copied to the directory of your project.

  2. No dependence on other libraries: EasyBMP should not depend upon external and/or special libraries, such as GTK or QT. Currently, EasyBMP is is completely self-contained, so this requirement is satisfied.

  3. Cross-platform compatible: The library should be portable across operating systems and processor architectures without modification. Currently, this goal has been achieved. The library has been tested on both big-endian (e.g., PowerPC, Sun Sparc4) and little-endian (e.g., Pentium 4, AMD Athlon) platforms on a variety of operating systems.

  4. Easy to Compile Code: Code should be easy to compile and should not require a lot of fancy arguments. EasyBMP attains this goal; all you have to do is include EasyBMP.h in your project, and compile it along with your project. Read more about compiling with EasyBMP here.

  5. Small size: The library should be kept small (and simple). As of April 2006, the entire set of code is roughly 53 KB in size. In keeping with the philosophy of the library, we hope to always keep the core library under 50-60 KB in size.

  6. Well-documented: The code should be well-supported, with a thorough user's manual. EasyBMP provides a complete user's manual is provided that is frequently updated, with examples provided wherever necessary. Furthermore, EasyBMP provides code samples to assist those who are new to the library and illustrate its use.

I suppose that a quick note on what EasyBMP is not is also in order. It's not intended to provide tools for higher-level things like drawing lines, converting between image formats, font support, or the like. (Although some of these things are easily accomplished with the library, and others are provided through add-ons.) It's simply a fast and easy way to bring graphics data in and out of your program.


EasyBMP had its first roots in mid 2003, when I was taking a graduate-level graphics course at the University of Minnesota. Incidentally, it was also my first computer science course, and so it was difficult for me to adapt other people's code to my projects. I needed to read and write Windows bitmap files for a "from-scratch" raytracing program, and the TA's provided I/O files just wouldn't compile for me in Windows. As I didn't have a lot of time for fussing about with his code, and because 24-bit BMP files were so well documented, I quickly wrote up my own classes and moved on with the project.

A few months later, I started to become dissatisfied with the large overhead of Matlab when using it for scientific visualization. I needed a quick and dirty way to read and write images. I already had done some work with Windows BMP files and didn't relish the thought of digging through other libraries that were difficult to learn, poorly documented, or not readily usable in both Windows and Linux. Since I thought it would be a good learning experience, I returned to my BMP classes and expanded them. Eventually, I added support for 4-bit and 8-bit files, and since then, I've been using them in all my home-grown scientific visualization applications.

Fast-forward to January 2005. By this point, I had been using my simple library for over a year with good results. They were user-friendly enough for the novice programmer (me) and well-tested. I decided to start writing up a user's guide so I wouldn't forget how things work, and in the process, I decided to release it as my first open source project. Perhaps some other programmers seeking a no-nonsense, simple, and well-documented bitmap library can also make use of it. I've gotten a lot out of open source software in the last few years. Hopefully, I can finally start giving back in my own small way. :-)


EasyBMP is open source software licensed under the Modified/Revised BSD License. In essence, you are free to use, modify, and distribute this library in your personal, academic, and commerical applications so long as you retain the copyright and limited liability statements. You can learn more about the BSD license and its compatibility with the GPL here.