首页 > 其他分享 >BMP文件格式及相应结构体

BMP文件格式及相应结构体

时间:2024-05-11 19:52:37浏览次数:22  
标签:__ short int unsigned bitmap header BMP 文件格式 相应

// 文件信息结构体
typedef struct tag_bitmap_file_header
{
    unsigned short file_type; // 文件标识,为字母ASCII码“BM”
    unsigned int file_size;   // 位图文件大小,以字节为单位
    unsigned short reserved1; // 位图文件保留字,必须为0
    unsigned short reserved2; // 位图文件保留字,必须为0
    unsigned int offset_bits; // 文件开始到位图数据开始之间的偏移量字节
} __attribute__((packed)) bitmap_file_header;

// 位图信息结构体
typedef struct tag_bitmap_info_header
{
    unsigned int bitmap_info_size; // 图像描述信息快的大小,常为28H
    int bitmap_width;              // 图像宽度
    int bitmap_height;             // 图像高度
    unsigned short planes;         // 图像的plane总数(恒为1)
    unsigned short image_depth;    // 记录颜色的位数取值1(双色),4,6,24,,3
    unsigned int compression;      // 数据压缩方式(0:不压缩;1:8位压缩;2:4位压缩
    unsigned int image_size;       // 图像区数据的大小,必须是4的倍数
    int x_pels_permeter;           // 水平每米有多少像素,在设备无关位图中,填写00H
    int y_pels_permeter;           // 垂直每米有多少像素,在设备无关位图中,填写00H
    unsigned int color_used;       // 此图像所有的颜色数,不用,固定为0
    unsigned int color_important;  // 重要颜色数,不用,固定为0
} __attribute__((packed)) bitmap_info_header;

// 调色板信息结构体
typedef struct tag_bitmap_palette
{
    unsigned char blue;
    unsigned char green;
    unsigned char red;
    unsigned char reserved;
} __attribute__((packed)) bitmap_palette;

标签:__,short,int,unsigned,bitmap,header,BMP,文件格式,相应
From: https://www.cnblogs.com/zeratul/p/18187091

相关文章

  • 利用系统IO读取磁盘上指定BMP图片的宽和高以及大小
    文件IO代码/***************************************************************************************filename:1.c*author: [email protected]*date:2024/05/11*function: 利用系统IO读取磁盘上指定BMP图片的宽和高以及大小*......
  • 获取任意bmp图片的参数函数设计
    /**@Author:[email protected]*@Date:2024-05-0814:24:52*@LastEditors:[email protected]*@LastEditTime:2024-05-1118:57:02*@FilePath:\数据结构text\text,.c*@Description:这是默认设置,请设置`customMade`,打开koroFileHeader查看配置进行设......
  • 获取bmp图片信息
    /********************************************************************* filename: get_bmp_info.c* author :lzj* date :2024/05/11* function:获取bmp图片信息* note :None** CopyRight(c)[email protected]***......
  • BMP的结构体定义模板
    /****BMP文件头数据结构****/typedefstruct{unsignedchartype[2];//文件类型unsignedintsize;//文件大小unsignedshortreserved1;//保留字段1unsignedshortreserved2;//保留字段2unsignedintoffset;//......
  • A* 算法、PathFinding问题中的 allow diagonal 和 don't cross corners,以及 .map文件
    地址:https://webdocs.cs.ualberta.ca/~nathanst/papers/benchmarks.pdf关于地图文件:.map文件的格式参考:https://movingai.com/benchmarks/formats.html......
  • Windows 防火墙是Windows操作系统中内置的网络安全功能,用于保护服务器免受网络攻击和
    Windows 防火墙是Windows 操作系统中内置的网络安全功能,用于保护服务器免受网络攻击和未经授权的访问。它可以帮助管理员限制进入和离开服务器的网络流量,以及监控网络通信并采取相应的安全措施。以下是Windows 防火墙的一些特点和功能:网络流量过滤:防火墙可以根据管......
  • HEX文件格式相关
    Hex文件是可以烧录到MCU中,被MCU执行的一种文件格式。如果用记事本打开可发现,整个文件以行为单位,每行以冒号开头,内容全部为16进制码(以ASCII码形式显示)。Hex文件可以按照如下的方式进行拆分来分析其中的内容:例如“:1000080080318B1E0828092820280B1D0C280D2854”可以被看作“0x10......
  • ELF文件格式解析器 原理 + 代码
    参考:https://bbs.kanxue.com/thread-259901.htm写在前面:   读《Linux二进制》,发现作者对ELF文件格式部分并没有做详细介绍,为了加深对elf文件格式理解,我自己着手写了个解析器,会和readelf工具协同对比。 原理:  ELF文件(目标文件)格式主要三种:1.可重定向文件(Re......
  • 如何找到相应程序的bin目录?(以MySQL为例)
    用win+R打开[运行]接着输入services.msc打开[服务] 在[名称]当中找到相应的程序,双击进入,如MySQL 就可以找到相应程序的bin目录啦......
  • 数码相框-显示bmp图片
    写主函数和测试功能#include<unistd.h>#include<stdlib.h>#include<stdio.h>#include<config.h>#include<draw.h>#include<encoding_manager.h>#include<fonts_manager.h>#include<disp_manager.h>#include<inpu......