File Header Size

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I need to know the file header size of various document type files like pdf, MS-word, Libre Office and any document type file format. I got a list of file format at wikipedia https://en.wikipedia.org/wiki/File_format
but I
can't see information about the header size. For instance, I know the header size of bmp file=54 bytes.Can some body please guide me any link which tells me this information.

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,045
Hi,
I need to know the file header size of various document type files like pdf, MS-word, Libre Office and any document type file format. I got a list of file format at wikipedia https://en.wikipedia.org/wiki/File_format
but I
can't see information about the header size. For instance, I know the header size of bmp file=54 bytes.Can some body please guide me any link which tells me this information.

Zulfi.
Actually, the normal BMP file has a 14 byte file header. This is followed by a 40 byte image header. So you need to aware of exactly what you are referring to when you talk about "the file header".

There are thousands of types of files (and probably hundreds of "document" file types). Why do you need to know the size of the file headers and which types, specifically? Also, the size of the headers for many file types is not static. Consider BMP files, for instance. There are many different versions of the BMP file specification and only one of them (albeit the most common one) has a 54-byte file/image header.

In general, you are going to need to research each file type you are interested in individually in more depth.
 

WBahn

Joined Mar 31, 2012
30,045
That's not what he's looking for. Those are the "magic bytes" that are the first few bytes of a file of a particular type that helps systems make a decent guess at what kind of file it is. The magic bytes are just the first portion of a longer header in almost all cases. He's looking for the size of the entire header.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Actually, the normal BMP file has a 14 byte file header. This is followed by a 40 byte image header. So you need to aware of exactly what you are referring to when you talk about "the file header".

There are thousands of types of files (and probably hundreds of "document" file types). Why do you need to know the size of the file headers and which types, specifically? Also, the size of the headers for many file types is not static. Consider BMP files, for instance. There are many different versions of the BMP file specification and only one of them (albeit the most common one) has a 54-byte file/image header.

In general, you are going to need to research each file type you are interested in individually in more depth.
Thanks. I am trying it but can't get that information. I need the part where the meta data resides. Yes some thing like the combination of 14+40 in case of document files. That is size before the actual user data begins.

Yes there are thousands but this does not mean we can identify them. There must be some way to distinguish them.

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,045
Thanks. I am trying it but can't get that information. I need the part where the meta data resides. Yes some thing like the combination of 14+40 in case of document files. That is size before the actual user data begins.

Yes there are thousands but this does not mean we can identify them. There must be some way to distinguish them.

Zulfi.
What problem, specifically, are you trying to address? WHY do you want to know what the size of the headers are? If you know that a .bfd file (Bob's Favorate Document) has a 19 byte header, what are you going to do with that information and how will that help you address the problem you are trying to solve?

Remember, just because a file begins with a particular sequence of bytes does not mean that you can tell what kind of file it is.

Most BMP files start with "BM", but so would a text file that started with the sentence "BMW list prices for selected models."
 

WBahn

Joined Mar 31, 2012
30,045
Hi,
Can we retrieve this information using Linux 'file' command?

Zulfi.
Retrieve what information? How many bytes are in the header? No. That's not what the file command does. It attempts to identify what kind of file the file is and provides information relevant to that question.
 
Top