views:

72

answers:

4

I'm trying to write a very simple image processing program for fun and practice. I was using System.Drawing. ... .Bitmap class to handle images and edit their data. but now I want to write my own class of Bitmap object implementation and want to know how bmp files (and other common bitmap formats) and their meta-data (indexing, color system & etc) are stored in files, and how to read and write them directly?

A: 

You're looking for the Wikipedia aricles on the BMP and JPEG file formats, and the File and FileStream classes in .Net.

SLaks
A: 

Wikipedia is your friend I think;

Rhapsody
+1  A: 

http://www.wotsit.org/ is a good place for file format documents

BMP is pretty simple and a good place to start. The next one I'd do is TIFF and then you can pick the compressions that seem easiest to do. The main issue with jumping to JPEG is understanding how to do the compression.

There are open-source libraries for the main formats that you can look at for guidance (libpng, libjpeg, libtiff).

Lou Franco
@ Lou Franco: http://www.wotsit.org/ was very useful
Sorush Rabiee
A: 

The BMP file format is a simple one, you'll have little trouble creating your own. But you'll hit the wall on a compressed format like PNG, TIFF or JPEG. Nobody writes an encoder for these, there are well established reference implementations for them. They are written in C, the universal language for libraries like these.

Google "libpng", "libtiff" and "libjpeg" to find them. You'll need a C compiler to turn them in a DLL that you can P/Invoke.

Hans Passant