BMP

来源:互联网 发布:现代远程网络教育 编辑:程序博客网 时间:2024/04/29 21:46

以下面这幅图为例

 

上面就是此幅24位图的图像结构,真正的RGB数据是从0x36这位开始的。而且还提供了图片的尺寸width of image data & height of image data。对我们后边进行转换提供了充足的信息。

  差点就忘记说了:bmp文件中还有一个特殊的地方,就是它的数据存储方式是从左下角开始的,如下图所示:
所以在转成YUV格式的时候,还需要将行进行颠倒才能看到正常的YUV图像。

 
offset  
size(byte)
field
data
0x 0
0x 2
0x 6
0x 8
0x a
0x e
0x12
0x16
0x1a
0x1c
0x1e
0x22
0x26
0x2a
0x2e
0x32
0x36
0x36
+4*n
2  
4  
2  
2  
4  
4  
4   
4   
2   
2   
4   
4   
4   
4   
4   
4   
4*n
“BM”                      
File Size(byte)             
(Reserved)                  
(Reserved)                  
start offset of image data  
size of Bitmap Header       
width of image data(pixel)  
height of image data(pixel) 
‘1’                        
bit / pixel (1,2,8,16,24)   
compress mode               
compressed image size       
level resolution( pixel /1m)
vertical resolution(pixel/1m)
numbers of use color        
important color             
color map ( if exists)      
image Data                  
B,G,R,B,G,R,B,G,R .......   
0x42 0x4d         
0x0000e136             
                              
                                
0x00000036                  
0x00000028                   
0x000000a0                      
0x00000078                       
0x0001         
0x0018                     
0                          
0x0000e100                     
N/A                          
N/A                           
0                           
0                       
N/A                       
                                
f0,c0,50,                   
f0,c1,4e,
原创粉丝点击