1. Course
  2. Binary Files
  3. Read dimensions of BMP image

Read dimensions of BMP image

Last updated: 8/23/2020 Difficulty: Intermediate

Create a program in C# to read the dimensions of an image in Windows bitmap format. You should first check that it is a valid .bmp image, reviewing the header data 'BM'. If it is a valid .bmp image then it obtained its dimensions (width x height) and display them on the screen.

It is a format of the Windows operating system. You can save images up to 24 bits (16.7 million colors).

The header of a BMP image is as follows:

Description Bytes
Type (BM) 0-1
Size 2-5
Reserved 6-9
Start of image data 10-13
Bitmap size 14-17
Width (pixels) 18-21
High (pixels) 22-25
Number of plans 26-27
Size of each point 28-29
Compression 30-33
Image size 34-37
Horizontal resolution 38-41
Vertical resolution 42-45
Table color size 46-49
Color counter 50-53





Binary Files

2 / 7

Android App

Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty

Learn C# at your own pace, the exercises are ordered by difficulty.