Soroush Rabiei
Soroush Rabiei

Reputation: 10868

How to find about structure of bitmap and JPEG files?

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?

Upvotes: 2

Views: 2167

Answers (4)

Hans Passant
Hans Passant

Reputation: 941218

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.

Upvotes: 1

Lou Franco
Lou Franco

Reputation: 89142

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).

Upvotes: 1

Rhapsody
Rhapsody

Reputation: 6077

Wikipedia is your friend I think;

Upvotes: 0

SLaks
SLaks

Reputation: 887195

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

Upvotes: 0

Related Questions