Header file learning, geotiff

Source: Internet
Author: User
Tags bmp image ultraedit
Define the file header as a data segment at the beginning of the file to undertake certain tasks (I am not sure whether it is all at the beginning of the file, but generally it is at the beginning)

[Edit this section]

Explanation

Although this file header is similar to the header file in C language, there is no relationship between these two items: the header file is a function containing data interface.StatementCarrier File[1], while the file header is directly located in a piece of data in the file, is part of the file

We should know that there are many types of files in the microcomputer, and files of the same type may be more or less different. file types include EXE, COM, BMP, GIF, WMV, ape, rmvb, FLV, SwF, txt, CPP, and ASM. Of course, some files do not have a file header, such as txt, if you do not believe it, you can use ultraedit to open a text file. Except for the characters in the text file, you will not see any other data. different types of files, as long as the extension name is different, the operating system can identify this file and use differentProgramTo open this file, such as a jpeg file, which has a general JPG extension name. When you double-click this type of file, the operating system automatically selects the corresponding program to open this file, for example, open it with ACDSee. however, it is worth noting that there are differences between files of the same type. Here we use BMP as an example. You can imagine what is the biggest difference between different images, someone may say something about it. I can tell you what you want to do! I wonder if you have thought about how the Image Browsing software recognizes the image size when you see images of different sizes? This is actually the credit of the document header! The following is a demonstration:

Create a 64*64-bit 16-bit pure white BMP image with the built-in Drawing Software in windows, save it as 1.bmp

Then, change the image size to 128*64, and convert it to 2.bmp.

Two things you can see on the ACDSee page

Use ultraedit to open the two files at the same time and check the first 32 bytes of the two files:

1. BMP:

00000000 H: 42 4D 76 08 00 00 00 00 00 00 00 00 28 00; BMV ...... v ...(.

00000010 H: 00 00 40 00 00 00 40 00 00 00 01 00 04 00 00 00 ;..@...@.........

2. BMP:

00000000 H: 42 4D 76 10 00 00 00 00 00 00 00 28 00; BMV ...... v ...(.

00000010 H: 00 00 80 00 00 00 40 00 00 00 01 00 04 00 00 00 ...@.........

Because this is hexadecimal data, we need to change the width and height of the original image to hexadecimal to find the data we want to see.

The decimal 128 is equal to the hexadecimal 80, and the decimal 64 is equal to the hexadecimal 40. In this way, we can find the data in the second row.

This process is just to let everyone know about the file header. In fact, the data is standard, and the BMP entry of Baidu encyclopedia has the file structure of the BMP file.

Long biwidth; // The bitmap width, in pixels (18-21 bytes)[2]

Long biheight; // The height of the bitmap, in pixels (2-25 bytes)

18-21 bytes of data is 80 00 00 00, which is a dual word, in fact, 80, the data in the memory is put in this way, this is not a problem

Should you have a little understanding of the file header when writing so much?

The file header is used to describe some important attributes of a file. It tells the program that opens and processes the file. For example, the BMP file header above tells ACDSee about the length, width, and pixel values, ACDSee displays the image based on the data in the file header and the body of the image data.

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.