开发者

How to find about structure of bitmap and JPEG files?

开发者 https://www.devze.com 2022-12-24 17:40 出处:网络
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 cla

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 me开发者_运维问答ta-data (indexing, color system & etc) are stored in files, and how to read and write them directly?


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.


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


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


Wikipedia is your friend I think;

  • Bitmap - File format
  • More formats
0

精彩评论

暂无评论...
验证码 换一张
取 消