BMP file Format

Source: Internet
Author: User
Tags bmp image file size reserved
BMP file Format

6.1.1 Introduction

The bitmap file (Bitmap-file,bmp) format is the image file storage format used by Windows, which is supported by all image processing software running in the Windows environment. The previous BMP bitmap file format for Windows 3.0 is related to the display device, so it is referred to as a device-dependent bitmap (device-Dependent bitmap,ddb) file format. The BMP bitmap file format after Windows 3.0 is independent of the display device, so this BMP bitmap file format is called a device-independent bitmap (device-independent bitmap,dib) Format to allow Windows to display BMP bitmap files on any type of display device. BMP bitmap File The default file name extension is BMP or BMP.

6.1.2 File Structure

A bitmap file can be seen as consisting of 4 parts: a bitmap file header (Bitmap-file header), a bitmap information header (bitmap-information header), a color table, and a byte array that defines a bitmap. Their names and symbols are shown in table 6-01.

Table 6-01 BMP image File component names and symbols

The composition of the bitmap file

Structure name

Symbol

Bitmap file Header (Bitmap-file header)

Bitmapfileheader

Bmfh

Bitmap Information Header (bitmap-information header)

Bitmapinfoheader

Bmih

Colored tables (color table)

Rgbquad

Acolors[]

Image data Array byte

BYTE

Abitmapbits[]

The bitmap file structure can be synthesized in table 6-02.

Table 6-02 Summary of bitmap file structure contents

Offset amount

Name of the domain

Size

Content

 

 

 

Image file

Head

0000h

Identifier (Identifier)

2 bytes

The two-byte content is used to identify the type of bitmap:

' BM ': Windows 3.1x, up, NT, ...

' BA ': OS/2 Bitmap Array

' CI ': OS/2 Color Icon

' CP ': OS/2 Color Pointer

' IC ': OS/2 Icon

' PT ': OS/2 Pointer

0002h

File Size

1 DWORD

The size of the entire file represented in bytes

0006h

Reserved

1 DWORD

Reserved, set to 0

000Ah

Bitmap Data Offset

1 DWORD

The offset between the data starting from the beginning of the file in the bitmap (bitmap data)

000Eh

Bitmap Header Size

1 DWORD

The length of the bitmap information header (Bitmap info header), used to describe the color of the bitmap, the compression method, and so on. The following lengths indicate:

28h-windows 3.1x, N/A, NT, ...

0CH-OS/2 1.x

F0H-OS/2 2.x

0012h

Width

1 DWORD

The width of the bitmap, in pixels

0016h

Height

1 DWORD

The height of the bitmap, in pixels

001Ah

Planes

1 word

Number of bits of bitmap


Image

Information

Head

 

 

001Ch

Bits Per Pixel

1 word

The number of bits per pixel

1-monochrome bitmap

4-16 Color Bitmap

8-256 Color Bitmap

16-16bit (high color) bitmap

24-24bit (True Color) bitmap

32-32bit (True Color) bitmap

001Eh

Compression

1 DWORD

Compression Description:

0-none (also using BI_RGB)

1-rle 8-bit/pixel (also using bi_rle4)

2-rle 4-bit/pixel (also using Bi_rle8)

3-bitfields (also using bi_bitfields)

0022h

Bitmap Data Size

1 DWORD

The size of the bitmap data represented by the number of bytes. The number must be a multiple of 4

0026h

Hresolution

1 DWORD

Horizontal resolution expressed in pixels/meters

002Ah

Vresolution

1 DWORD

Vertical resolution expressed in pixels/meters

002Eh

Colors

1 DWORD

The number of colors used by the bitmap. If 8-bit/pixel is represented as 100h or 256.

0032h

Important Colors

1 DWORD

Specifies the number of important colors. When the value of the field equals the number of colors, it means that all colors are equally important

Palette data

0036h

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.