EXIF format analysis and through XML processing
Raptor [Mental Studio] (Personal Column) (Blog)
Http://eental.mentsu.com
Starting length (bytes) Content 0x00 2 Number of Directory Entries (count) 0x02 12 * Count Directory Entries 2 12 * Count 4 Offset of Next IFD
Table 4: IFD format definition
Each IFD consists of three parts, as shown in Table 4, including: Number Of Directory Entries, Directory Entries, and Offset of Next IFD. Where Number Of Directory Entries specifies how many Entry included in Directory Entries. Directory Entries is an array that contains several Directory Entry. The last OFFSet of Next ifd is where the next IFD is located, if this is 0, then this is the last IFD in the linked list.
Starting length (bytes) content 0x00 2 tag 0x02 2 Type 0x04 4 size 0x08 4 Value
Table 5: IFD Entry Format Definition
IFD Entry is a 12-byte long structure as shown in Table 5. As the name of Tifff said: a tag-based file format for storing and interchanging raster images [2]. All IFD Entry is identified by tag, each TAG is a value of a Word type, each having its specific meaning. Such as 0x0131 This TAG indicates that this entry records the software name of generating this TIFF file. The meaning of each TAG may check the specification document of TIFF [2]. EXIF only uses some of the TAG, and three TAGs are expanded to link EXIF three expansion IFDs, which have instructions in EXIF's specification documents [1].
TYPE in IFD Entry is a data type recorded in this entry, and the TIFF specification only defines five types, and EXIF has increased three. Table 6 shows:
TYPE Type Size Value 1 Byte 1 byte Data, SIZE is generally 1 if size is greater than 4, the value is a string of ASCII n, Size is a string length, including the end of the NULL character size less than or equal to 4 Store Size is greater than 4 in Value, specifying its position in Value 3 Short 1 unsigned short integer, size is generally 1 if size is greater than 2, then Value is its location 4 long 1 no symbol length, size is generally 1 5 Rational 1 If TIFF is expressed in the form of a score, with two long-type data, the previous long is a molecule, the latter long is a denominator, and Size is generally 1. Because a Rational Type contains two long, it cannot be recorded in value, so recorded in Value is the type of this Rational number is located (from Tiff HEADER) or more, the TIFF defined type, the following is the exiF extension definition type 7 Undefined n arbitrary byte data, depending on the specific case, the Size is less than or equal to 4 directly stored in the value greater than 4, then specifying its position in Value 9 Slong 1 has a symbol length, similar to LONG, with 2 complement The form indicates that the 10 SRATIONAL 1 has a symbolic number, similar to Rational, but use two slong to indicate Table 6: Type definition
It is important to note that it may be that the data itself may be the offset of the data storage location, depending on the size of Type and Size. The data storage position is the offset calculated from Tiff Header.
One thing to note is that the three expansion IFD tags of EXIF are also the LONG type, which is recorded by the starting position of the corresponding IFD (offset from Tiff Header). The TAG used in the expansion IFD is all EXIF redefined.
(to be continued)