位图文件头的大小 [英] Bitmap file header size

查看:100
本文介绍了位图文件头的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是bmp文件编程的新手,我检查了此网站以了解bmp标头. http://www.daubnet.com/en/file-format-bmp

I'm a newbie in programming bmp files and i checked this web site to learn about bmp header.. http://www.daubnet.com/en/file-format-bmp

bmp文件的标题似乎是54个字节.

it seems that the header of a bmp file is 54 bytes.

使用绘画,我创建了一个简单的10x10图像,并将其保存为24位. 因此,根据简单的数学计算,文件大小应为10 * 10 * 3 + 54 = 354字节.

Using paint, i created a simple 10x10 image, and i saved it in 24 bits. so according to simple math, the file size should be 10*10*3 + 54 = 354 bytes.

,但是十六进制编辑器和文件资源管理器返回了374个字节的大小.

but hex editor and file explorer returned a size of 374 bytes.

所以我有20个字节的差异,我也不知道为什么.

So i have a difference of 20 bytes, and i don't know why.

你能告诉我为什么吗?

could you tell me why please?

非常感谢!

推荐答案

BMP中的行被填充为4字节的倍数.

Lines in BMPs are padded out to multiples of 4 bytes.

不带填充,每行为3 * 10 = 30字节.使用填充,每行为32字节,因此图像数据的大小为320字节.因此,文件大小为54 + 320 = 374字节.

Without padding, each line is 3*10 = 30 bytes. With padding, each line is 32 bytes, so the image data is 320 bytes in size. Thus, the file size is 54+320 = 374 bytes.

这篇关于位图文件头的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆