如何了解位图和JPEG文件的结构?
我正在尝试编写一个非常简单的图像处理程序,以供娱乐和练习。我正在使用 System.Drawing。 ....Bitmap 类来处理图像并编辑其数据。但现在我想编写自己的位图对象实现类,并想知道 bmp 文件(和其他常见位图格式)及其元数据(索引、颜色系统等)如何存储在文件中,以及如何读取然后直接写?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(4)
BMP 文件格式是一种简单的文件格式,创建自己的文件格式不会有什么困难。但对于 PNG、TIFF 或 JPEG 等压缩格式,您可能会遇到困难。没有人为这些编写编码器,它们有完善的参考实现。它们是用 C 语言编写的,C 语言是此类库的通用语言。
谷歌“libpng”、“libtiff”和“libjpeg”来找到它们。您需要一个 C 编译器将它们转换为可以 P/Invoke 的 DLL。
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/ 是文件格式文档的好地方
BMP 非常简单,一个好的起点。我要做的下一个是 TIFF,然后您可以选择看起来最容易进行的压缩。跳转到 JPEG 的主要问题是了解如何进行压缩。
您可以查看主要格式的开源库以获取指导(libpng、libjpeg、libtiff)。
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).
您正在查找有关 BMP 和 JPEG 文件格式,以及
文件
和 .Net 中的FileStream
类。You're looking for the Wikipedia aricles on the BMP and JPEG file formats, and the
File
andFileStream
classes in .Net.我认为维基百科是你的朋友;
Wikipedia is your friend I think;