Detailed description of TIFF image file format (1)

Source: Internet
Author: User

1. What is Tiff?
Tiff is the abbreviation of Tagged Image File Format. In the current standard, only tiff exists, and other terms are no longer used. As a markup language, the biggest difference between TIFF and other file formats is that in addition to image data, it can also record a lot of other information about the image. It records image data in a more flexible way. Theoretically, any other image format can be used by TIFF and embedded into tiff. For example, JPEG, lossless JPEG, MPEG-4, and original uncompressed data of any data width can be easily embedded into tiff. Due to its scalability, Tiff has been widely used in digital influence, remote sensing, medicine, and other fields. The suffix of The TIFF file is. tif or. Tiff.

2. TIFF file structure

The three keywords in the TIFF file are: Image File Header (IFH), image file directory (IFD), and directory item directory entry (de ). Each image starts with an 8-byte IFH, which points to the first IFD. IFD contains various information about the image and a pointer to the actual image data.

IFH composition:
Byte 0-1: byte sequence flag. The value is II or mm. II indicates that the smallest byte is in front, also known as Little-Endian. MM indicates that the size of the byte goes first and becomes big-Endian.
Byte 2-3: indicates the position of TIFF, generally 42
Byte 4-7: the offset of the first IFD. It can be anywhere, but must be at the boundary of a word, that is, it must be an integer multiple of 2.

IFD structure (0 indicates the starting position of the IFD ):
Byte 0-1: indicates the number of de contained in the IFD. Assume that the number is N.
Byte 2-(N * 12 + 1): n de
Byte (N * 12 + 2)-(N * 12 + 5): offset of the next IFD. If not, set it to 0.

Structure of de:
Byte 0-1: the unique identifier of this tag
Byte 2-3: data type.
Byte 4-7: quantity. The type and quantity can be used to determine the number of bytes required to store the tag.
Byte 8-11: if the number of bytes occupied is less than 4, the data is stored directly here. If there are more than four, the pointer to the actual data is stored here.

It can be represented by the following diagram (from the http://www.cppblog.com/windcsn/archive/2009/03/12/1158.html)

 

In iis6.0, 12 data types are defined:

1 = byte 8-bit unsigned integer.
2 = ASCII 8-bit byte that contains a 7-bit ASCII code; the last byte
Must be NUL (Binary zero ).
3 = short 16-bit (2-byte) unsigned integer.
4 = long 32-bit (4-byte) unsigned integer.
5 = rational two longs: The first represents the numerator
6 = sbyte an 8-Bit Signed (twos-complement) integer.
7 = undefined an 8-bit byte that may contain anything, depending on
The definition of the field.
8 = sshort a 16-bit (2-byte) signed (twos-complement) integer.
9 = slong a 32-bit (4-byte) signed (twos-complement) integer.
10 = srational two slong's: the first represents the numerator of
Fraction, the second the denominator.
11 = float single precision (4-byte) IEEE format.
12 = double precision (8-byte) IEEE format.

 

-A tiff file may contain multiple ifds. Each IFD is a subfile. The baseline decoder only needs to solve the image data corresponding to the first IFD. Extended tiff images often contain multiple ifds, each of which contains different information.


3. Content that may be involved in the future

(1) important basic tags

(2) Important extended tags

(3) important private tags

(4) tiff/EP and DNG

(5) Tiff-related software

(6) Limitations of TIFF and Future Development

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.