C++ - 我怎样才能对bmp文件进行一些操作?
我很感兴趣做一些转换,比如将一种颜色更改为另一种颜色,计算所有使用的颜色,以及调整图像大小。我不想想使用任何现有的库,我想自己编写所有代码。
总结:如何打开 BMP
文件并更改它?
I am interesting to do some transformation, like change one color to another, count all used colors, and resize image. I DO NOT want to use any exist library, I would like write myslelf all code.
Summing up: How could I open BMP
file and change it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先学习位图文件格式。它非常容易理解和实施。
您可以通过访问 www.wotsit.org 并搜索所需的文件类型来获取任何文件格式。在你的情况下是BMP。位图有不同类型,因此您可以确定要实现哪些类型。
Start by learning the bitmap file format. It is very easy to understand and implement.
You can get any file format by going to www.wotsit.org and searching for the file type you want. In your case BMP. There are different types of bitmaps so you can figure out which ones you want to implement.
我将从阅读一些文档开始。也许可以去维基百科查看概述。
I would start with reading some documentation. Maybe go to Wikipedia for an overview.
您需要读入二进制文件,弄清楚所有位的含义,进行转换,然后写出一个新的二进制文件。为了弄清楚各种二进制文件的格式,wotsit 是我找到的最好的资源。他们有 5 个
BMP
格式文件规范的链接。You need to read in the binary file, figure out what all the bits mean, do your transformation, and write out a new binary file. For figuring out the format of various binary files, wotsit is the best resource I've found. They have links to 5 specs for
BMP
format files.