一、BMP文件由文件头、位图信息头、颜色信息和图形数据四部分组成。
1、BMP文件头(14字节)
typedef struct /**** BMP file header structure ****/
{
unsigned int bfSize; /* Size of file */
unsigned short bfReserved1; /* Reserved */
unsigned short bfReserved2; /* ... */
unsigned int bfOffBits; /* Offset to bitmap data */
} MyBITMAPFILEHEADER;
2、位图信息头(40字节)
typedef struct /**** BMP file info structure ****/
{
unsigned int biSize; /* Size of info header */
int biWidth; /* Width of image */
int biHeight; /* Height of image */
unsigned short biPlanes; /* Number of color planes */
unsigned short biBitCount;

本文介绍了BMP文件的组成,包括文件头、位图信息头、颜色信息和图形数据,并详细讲解了如何将RGB数据保存为BMP图片,特别提到位图数据的像素值存储规则与颜色表的对应关系。
最低0.47元/天 解锁文章
1602

被折叠的 条评论
为什么被折叠?



