.bmp文件格式介绍与该类型文件读取的代码实现
2017-12-02 14:40
351 查看
.bmp文件格式(之后修改)
标准Windows数据格式,而且是设备无关的bitmap(二进制文件),很少采用圧缩形式,不适合存储动画基本结构
BITMAPFILEHEADER bmfh;bmfh包含文件自身的信息,而不是bitmap的信息
BITMAPINFOHEADER bmih;
bmih包含bitmap的信息
RGBQUAD aColors[];
aColors是颜色表
BYTE aBitmapBits[];
bmih的结构
精确的结构
数据情况size 100x100, 256 colors, no compressionstart-value以字节为单位,数据结构中的各个元素的起始位置;size-value ,数据结构中各个元素的大小,以字节为单位;purpose表示该数据结构元素的含义
BITMAPFILEHEADER
成员
name start size purpose
bfType 1 2 必须为’BM’,用于声明改文件为.bmp文件
bfSize 3 4 说明改文件的大小,以字节为单位
bfReserved1 7 2 保留至,设定为0
bfReserved2 9 2 保留至,设定为0
bfOffBits 11 4 说明位图像素内容相对于其实位置的偏移量
BITMAPINFOHEADER
biSize 15 4 说明BITMAPINFOHEADER这个数据结构的大小,标准值为40bytes
biWidth 19 用于说明图片的宽度,以像素为单位,如果为100*100的图像,则比biWidth=100
19 4 biWidth 100 specifies the width of the image, in pixels.
23 4 biHeight 100 specifies the height of the image, in pixels.
27 2 biPlanes 1 specifies the number of planes of the target device, must be set to zero.
29 2 biBitCount 8 specifies the number of bits per pixel.
31 4 biCompression 0 Specifies the type of compression, usually set to zero (no compression).
35 4 biSizeImage 0 specifies the size of the image data, in bytes. If there is no compression, it is valid to set this member to zero.
39 4 biXPelsPerMeter 0 specifies the the horizontal pixels per meter on the designated targer device, usually set to zero.
43 4 biYPelsPerMeter 0 specifies the the vertical pixels per meter on the designated targer device, usually set to zero.
47 4 biClrUsed 0 specifies the number of colors used in the bitmap, if set to zero the number of colors is calculated using the biBitCount member.
51 4 biClrImportant 0 specifies the number of color that are ‘important’ for the bitmap, if set to zero, all colors are important.
相关文章推荐
- 本文给出了一种方便实用的解决大文件的读取、存储等处理的方法,并结合相关程序代码对具体的实现过程进行了介绍
- ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- asp.net 读取并修改config文件实现代码
- net控件中数据导到Excel的格式 首先,我们了解一下excel从web页面上导出的原理。当我们把这些数据发送到客户端时,我们想让客户端程序(浏览器)以excel的格式读取它,所以把mime类型设为:application/vnd.ms-excel,当excel读取文件时会以每个cell的格式呈现数据,如果cell没有规定的格式,则excel会以默认的格式去呈现该cell的数据。这样就给我们提供了自定义数据格式的空间,当然我们必须使用excel支持的格式。下面就列出常用的一些格式: 1) 文本
- ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- 用asp实现读取文件的最后一行的代码
- ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- 读取DXF格式文件的C++代码
- Struts2实现文件下载(读取数据库CLOB类型的CDA)
- JQuery读取XML文件数据并显示的实现代码
- PHP读取Excel文件的实现代码
- ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- XCode数据类型转换代码 文件读取,写入,XY坐标获取,ASCII转换等
- 利用PHP实现智能文件类型检测的实现代码
- [导入]ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- 整理C# 读取文件Scv格式代码
- ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- 利用PHP实现智能文件类型检测的实现代码
- ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护(示例代码下载)
- fileupload控件 文件类型客户端验证实现代码