メインコンテンツまでスキップ

4. TIFF 画像ファイルの例

以下は、400 dpi で圧縮された約 100K バイトの MMR (G4) 符号化された単一画像について、TIFF ファイルの内容がどのようになり得るかの例です。まず一般的な概要を示し、その後に詳細な 16 進リストを示します。

4.A. サンプルファイル​

コメントは右側にあり、セミコロンで始まります。タグはタグコードの順に並べ替える必要があることに注意してください。

0:、IFDADDR:、STRIP0: はファイル内のアドレスであり、ファイルの先頭からのバイト数を表します。

   Header:

    0:  Byte Order=     hex 4D4D        ;first bytes of the file, from
                                        ;most significant bit to least
                                        ;significant (big endian)
        Version=        42 (hex 002A)   ;Must be 42
        First IFD=      IFDADDR         ;Address of first (and only) IFD

   Image File Directory (the only one in this example):

   IFDADDR:

        IFD Entry Count=      24        ;(NOT A TAG) Count of
                                        ; Number of IFD Entries

        NewSubFileType=        0
        ImageWidth=         3400        ;8.5 inches at 400 dpi
        ImageLength=        4400        ;11 inches at 400 dpi
        BitsPerSample=         1        ;Bi-Level
        Compression=           4        ;MMR
        Photometric-
           Interpretation=     0
        DocumentName=       "LAMap1"
        ImageDescription=   "A map of Los Angeles"
        Make=               "Fujitsu"
        Model=              "M3093E"
        StripOffsets=       <STRIP0>    ;There is only one strip in
                                        ;this example.  However, note
                                        ;that strips can be in any
                                        ;order.  (Offsets are from the
                                        ;beginning of the TIFF file.)

        SamplesPerPixel=       1        ;Bi-Level
        RowsPerStrip=       4400        ;Entire image in 1 strip
        StripByteCounts=    <COUNT0>    ;Byte count of entire
                                        ;compressed image

        XResolution=        400/1
        YResolution=        400/1
        XPosition=            0/1       ;position of left side of image
        YPosition=            0/1       ;position of top of image
        Group4Options=    hex 00000002  ;bit 1 on means uncompressed
                                        ;mode MAY be used

        ResolutionUnit=        2        ;Inches
        Software=           "Xionics"
        DateTime=           "1990:10:05 15:00:00"
        Artist=             "Joe Pro"
        HostComputer=       "Tardis.Isi.Edu"

        Next IFD Pointer=  hex 00000000 ;(NOT A TAG) Indicates no
                                        ; more IFDs in this file

    Image Data:

    <STRIP0>:       <actual compressed image data>

    [end of TIFF file]

この例ではストリップが 1 つだけです。複数ある場合、TIFF 仕様はそれらが特定の順序であることを要求していないことに注意してください。ストリップは任意の順序で与えられてもよく、TIFF リーダーは StripOffsets を使ってそれらの位置を特定しなければなりません。

また、TIFF 文書では、タグのデフォルト値に依存しないことを推奨しています。

4.B. 詳細な 16 進リスト​

ASCII 文字列が二重引用符で囲まれている場合を除き、すべてのオフセットと値は 16 進数で表されます。Value Offset は常に偶数でなければならないことに注意してください。これは、それが指す値が常に 16 ビットのワード境界上になければならないためです。

Name 列の項目は参照用であり、実際には TIFF ファイルの一部ではありません。

   Offset      Name                  Value
   ----        -------------------   -------------------------------------
  Header (first byte is Offset 0):
   0000        Byte Order             4D4D
   0002        Version                002A
   0004        1st. IFD pointer       00000010

  IFD (IFDADDR from above is 0010 here):
   0010        Entry Count            0018
   0012        NewSubFileType         00FE   0004   00000001  00000000
   001E        ImageWidth             0100   0004   00000001  00000D48
   002A        ImageLength            0101   0004   00000001  00001130
   0036        BitsPerSample          0102   0003   00000001  00010000
   0042        Compression            0103   0003   00000001  00040000
   004E        Photometric Interp.    0106   0003   00000001  00000000
   005A        DocumentName           010D   0002   00000007  00000136
   0066        ImageDescription       010E   0002   00000015  0000013E
   0072        Make                   010F   0002   00000008  00000154
   007E        Model                  0110   0002   00000007  0000015C
   008A        StripOffsets           0111   0004   00000001  000001A8
   0096        SamplesPerPixel        0115   0003   00000001  00010000
   00A2        RowsPerStrip           0116   0004   00000001  00001130
   00AE        StripByteCounts        0117   0004   00000001  <COUNT0>
   00BA        XResolution            011A   0005   00000001  00000164
   00C6        YResolution            011B   0005   00000001  00000164
   00D2        XPosition              011E   0005   00000001  0000016C
   00DE        YPosition              011F   0005   00000001  0000016C
   00EA        Group4Options          0125   0004   00000001  00000002
   00F6        ResolutionUnit         0128   0003   00000001  00020000
   0102        Software               0131   0002   00000008  00000174
   010E        DateTime               0132   0002   00000014  0000017C
   011A        Artist                 013B   0002   00000008  00000190
   0126        HostComputer           013C   0002   0000000F  00000198
   0132        Next IFD Pointer       00000000

  Fields Offsets Point to:
   0136        DocumentName          "LAMap1"
   013E        ImageDescription      "A map of Los Angeles"
   0154        Make                  "Fujitsu"
   015C        Model                 "M3093E"
   0164        X,Y Resolution        00000190 00000001
   016C        X,Y Position          00000000 00000001
   0174        Software              "Xionics"
   017C        DateTime              "1990:10:05 15:00:00"
   0190        Artist                "Joe Pro"
   0198        HostComputer          "Tardis.Isi.Edu"

  Image Data (<STRIP0> from above is here 01A8)
   01A8        Compressed Data for single strip, of length <COUNT0> bytes

    [end of TIFF file]

注: この例ではストリップが 1 つだけなので、StripByteCounts のカウントは 1 つだけ、StripOffsets のオフセットも 1 つだけです。したがって、これらのそれぞれは 4 バイトしか占めず、指し示されるのではなく Value Offset に直接収まります。