Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Bytes 0-1: The byte order used within the file. Legal values are: “II” (4949.H) “MM”(4D4D.H) In the “II” format, byte order is always from the least significant byte to the most significant byte, for both 16-bit and 32-bit integers This is called little-endian byte order. In the “MM” format, byte order is always from most significant to least significant, for both 16-bit and 32-bit integers. This is called big-endian byte order.

Bytes 2-3 An arbitrary but carefully chosen number (42) that further identifies the file as a TIFF file. The byte order depends on the value of Bytes 0-1.

Bytes 4-7 The offset (in bytes) of the first IFD. The directory may be at any location in the file after the header but must begin on a word boundary. In particular, an Image File Directory may follow the image data it describes. Readers must follow the pointers wherever they may lead. The term byte offset is always used in this document to refer to a location with respect to the beginning of the TIFF file. The first byte of the file has an offset of 0.

Am I correct in understanding that bytes 0-1 represent two 8-bit values, bytes 2-3 are a 16-number, and that bytes 4-7 are a 32-bit number?

share|improve this question
Hi Hatorade - are the questions you are asking homework questions? Can you consolidate all questions you have asked vis-a-vis TIFF into a single question thread? –  caliban Sep 7 '09 at 11:24
no, they are not homework. they are all on the same project though. and i've been told before to separate questions into unique questions rather than place multiple questions in the same posting. –  hatorade Sep 7 '09 at 11:26
Alright then, good luck in getting answers! –  caliban Sep 7 '09 at 11:27
add comment

1 Answer

up vote 4 down vote accepted
  1. Bytes 0-1 represent two 8-bit values>
    • yes
  2. bytes 2-3 are a 16-number?
    • Yes, it should be a 16-value that represents 42 in the order expected from the first two bytes
  3. and, that bytes 4-7 are a 32-bit number
    • yes. Its value is to be interpreted correctly based on the endian-ness confirmed earlier.

The little-endian start,

0x49 0x49 0x2A 0x00 0x67 0x45 0x23 0x01 ...
---- ---- --------- -------------------

Can be represented in big-endian as,

0x4D 0x4D 0x00 0x2A 0x01 0x23 0x45 0x67 ...
---- ---- --------- -------------------

Where the word has value 19088743.

Maybe this code reference will help you get it better.
Also, note my earlier comment on byte-sequences and words in the other answer...

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.