2000.06.10 11:26 "Resized version (NewSubfileType 1) images?!", by Ivo Penzar

2000.06.10 11:26 "Resized version (NewSubfileType 1) images?!", by Ivo Penzar

I recently ran across an MRI (Multi Resolution Image) TIFF file, created by "optirastoras: 1.6.0, 2" from "Optigraphics Corporation". It is an A4 facsimile document, stored in its original 9363x6592 version, followed by five downsized versions: 4682x3296, 2341x1648, 1171x824, 586x412 and 293x206. Indeed, first IFD is of NewSubfileType 0, while the others are of type 1 (flag 1 raised up) - see the dump below.

Observe that resized versions are missing PhotometricInterpretation and both TileWidth and TileLength tags. As the detailed analysis shows, they share these attributes from the IFD 0, so the "optirastoras 1.6.0, 2" probably thought it would not be necessary to repeat them for IFDs 1 to 5.

Since the TileWidth and TileLength tags are missing, libtiff concludes that resized versions have all just one tile each. This contradicts to the Count fields for TileOffsets and TileByteCounts tags in IFDs 1 to 5 (e.g., IFD 1 reports 70 tiles), hence the libtiff refuses to open broken IFDs 1 to 4.

libtiff [i.e., TIFFSetDirectory() function] does open the last IFD 5, concluding there must be one tile again for this whole bitmap. This tile would be then of size 304 by 208 (the smallest multiples of 16, greater or equal to the corresponding ImageWidth and ImageLength). "optirastoras 1.6.0, 2" considered however this single tile to be 512x512 (as the TileWidth and TileLength specified for the IFD 0), which causes later the function TIFFReadTile() to fail (Fax3 codec misunderstands the compressed bitmap).

In my humble opinion, libtiff behaves correct here. Although I didn't find a lot about resized images both in TIFF rev. 5 and 6 either, I am sure that there is no such thing there as sharing non-default attributes from one IFD to another (even if these are resized versions for the same image). E.g., full size image could be of type RGB, whereas resized versions (draft ones) might be palette type, grayscale or bilevel for printers, etc.

Or maybe I am wrong, together with libtiff. Actually, this was my first experience with a multiple resolution IFF image. I don't know how common they are and what is the de facto industry standard for them?!

Would like to hear your opinion/experience, and maybe to share some other multi resolution TIFF images. Thanks,

Ivo

============

TIFF file: "RXHDEMO19.tif".
Header:
 Byte order: little endian (Intel like).
 Version: 42 (ok).
 Offset to first IFD: 0x8.
IFD 0:
 Number of entries: 15.
  254   NewSubfileType                  LONG
1                     0
  256   ImageWidth                      LONG          1
9363
  257   ImageLength                     LONG          1
6592
  259   Compression                    SHORT
1                     4
  262   PhotometricInterpretation      SHORT
1                     0
  271   Make                           ASCII         25
*0x7c658
          [0] Optigraphics Corporation
  272   Model                          ASCII         13
*0x7c672
          [0] optirastoras
  274   Orientation                    SHORT
1                     1
  282   XResolution                 RATIONAL          1
*0x7c680
          [0]                 200/1
  283   YResolution                 RATIONAL          1
*0x7c688
          [0]                 200/1
  305   Software                       ASCII         23
*0x7c640
          [0] optirastoras: 1.6.0, 2
  322   TileWidth                       LONG
1                   512
  323   TileLength                      LONG
1                   512
  324   TileOffsets                     LONG        247
*0x7be88
          [0]     227632     228322     228688     228946
          [4]     229270     229592     229824     230116
          [8]     230392     230648     230936     231184
         [12]     231472     231774     232050     233070
         [16]     234098     235202     235322     235570
         [20]     236820     238786     239210     239946
         [24]     241244     241900     241968     242036
         [28]     242198     242266     242334     242508
         [32]     242576     242644     243198     243266
         [36]     243500     243568     243830     244978
         [40]     246372     247344     248608     250146
         [44]     250494     250562     251298     252460
         [48]     253204     253272     254332     255248
         [52]     255384     255938     256006     256240
         [56]     256308     256590     257176     257528
         [60]     258346     261432     262716     263242
         [64]     264688     266638     268540     269278
         [68]     270160     271686     274768     276030
         [72]     276464     276532     276738     276806
         [76]     277150     277704     278314     280494
         [80]     284130     286294     286852     288760
         [84]     291572     293454     295970     297104
         [88]     297730     301170     303736     304418
         [92]     304486     304728     304796     305076
         [96]     305806     307600     308664     310400
        [100]     311286     312044     313674     315376
        [104]     316670     317432     317866     318274
        [108]     320570     322224     322910     323268
        [112]     325464     329930     330394     331122
        [116]     332984     333194     333454     333522
        [120]     333590     334342     335488     337414
        [124]     339472     339918     339986     340062
        [128]     340138     342132     344680     347010
        [132]     351752     352584     353112     353180
        [136]     353306     353374     353446     353818
        [140]     355082     356504     358324     360080
        [144]     360268     360336     360404     360472
        [148]     362886     366922     368800     371560
        [152]     372260     373006     373840     373914
        [156]     373982     374052     374982     377052
        [160]     378816     380748     381728     381796
        [164]     381864     381932     382004     383292
        [168]     385616     388044     391974     392700
        [172]     393710     394964     395894     395962
        [176]     396030     397050     398250     399360
        [180]     399928     399996     400064     400132
        [184]     400200     401074     403296     407102
        [188]     412170     419484     420236     421242
        [192]     423986     427704     429596     430444
        [196]     431634     433682     435444     436314
        [200]     436382     436450     437046     440294
        [204]     442734     445912     449746     452332
        [208]     454698     455414     456260     457620
        [212]     459518     461130     461988     463082
        [216]     464712     466206     467118     467186
        [220]     467254     468046     472312     475204
        [224]     477560     480992     483484     485350
        [228]     486274     487126     487372     487546
        [232]     487746     487966     488506     489020
        [236]     489578     490266     490592     490854
        [240]     491552     492350     493908     497048
        [244]     501464     503884     506738
  325   TileByteCounts                  LONG        247
*0x7c264
          [0]        690        366        258        324
          [4]        322        232        292        276
          [8]        256        288        248        288
         [12]        302        276       1020       1028
         [16]       1104        120        248       1250
         [20]       1966        424        736       1298
         [24]        656         68         68        162
         [28]         68         68        174         68
         [32]         68        554         68        234
         [36]         68        262       1148       1394
         [40]        972       1264       1538        348
         [44]         68        736       1162        744
         [48]         68       1060        916        136
         [52]        554         68        234         68
         [56]        282        586        352        818
         [60]       3086       1284        526       1446
         [64]       1950       1902        738        882
         [68]       1526       3082       1262        434
         [72]         68        206         68        344
         [76]        554        610       2180       3636
         [80]       2164        558       1908       2812
         [84]       1882       2516       1134        626
         [88]       3440       2566        682         68
         [92]        242         68        280        730
         [96]       1794       1064       1736        886
        [100]        758       1630       1702       1294
        [104]        762        434        408       2296
        [108]       1654        686        358       2196
        [112]       4466        464        728       1862
        [116]        210        260         68         68
        [120]        752       1146       1926       2058
        [124]        446         68         76         76
        [128]       1994       2548       2330       4742
        [132]        832        528         68        126
        [136]         68         72        372       1264
        [140]       1422       1820       1756        188
        [144]         68         68         68       2414
        [148]       4036       1878       2760        700
        [152]        746        834         74         68
        [156]         70        930       2070       1764
        [160]       1932        980         68         68
        [164]         68         72       1288       2324
        [168]       2428       3930        726       1010
        [172]       1254        930         68         68
        [176]       1020       1200       1110        568
        [180]         68         68         68         68
        [184]        874       2222       3806       5068
        [188]       7314        752       1006       2744
        [192]       3718       1892        848       1190
        [196]       2048       1762        870         68
        [200]         68        596       3248       2440
        [204]       3178       3834       2586       2366
        [208]        716        846       1360       1898
        [212]       1612        858       1094       1630
        [216]       1494        912         68         68
        [220]        792       4266       2892       2356
        [224]       3432       2492       1866        924
        [228]        852        246        174        200
        [232]        220        540        514        558
        [236]        688        326        262        698
        [240]        798       1558       3140       4416
        [244]       2420       2854        784
 Offset to next IFD: 0x7c690.
IFD 1:
 Number of entries: 7.
  254   NewSubfileType                  LONG
1                     1
  256   ImageWidth                      LONG          1
4682
  257   ImageLength                     LONG          1
3296
  282   XResolution                 RATIONAL          1
*0x7c714
          [0]                 100/1
  283   YResolution                 RATIONAL          1
*0x7c71c
          [0]                 100/1
  324   TileOffsets                     LONG         70
*0x7c724
          [0]      97345      99225      99957     101097
          [4]     101321     101603     101863     102069
          [8]     103235     103921     104175     105725
         [12]     108585     110319     112275     114233
         [16]     115855     118315     118771     118983
         [20]     119307     121067     125111     126995
         [24]     130463     133441     134695     139255
         [28]     140011     143441     143795     145283
         [32]     145549     145743     147803     151393
         [36]     151713     151793     157273     163179
         [40]     163933     165699     166193     167153
         [44]     169939     171543     171611     172075
         [48]     176847     185959     186653     189441
         [52]     193717     195599     198569     199417
         [56]     200095     206387     212539     216873
         [60]     217649     218163     218327     218657
         [64]     219117     219579     220027     221129
         [68]     224729     227229
  325   TileByteCounts                  LONG         70
*0x7c83c
          [0]       1880        732       1140        224
          [4]        282        260        206       1166
          [8]        686        254       1550       2860
         [12]       1734       1956       1958       1622
         [16]       2460        456        212        324
         [20]       1760       4044       1884       3468
         [24]       2978       1254       4560        756
         [28]       3430        354       1488        266
         [32]        194       2060       3590        320
         [36]         80       5480       5906        754
         [40]       1766        494        960       2786
         [44]       1604         68        464       4772
         [48]       9112        694       2788       4276
         [52]       1882       2970        848        678
         [56]       6292       6152       4334        776
         [60]        514        164        330        460
         [64]        462        448       1102       3600
         [68]       2500        403
 Offset to next IFD: 0x7c954.
IFD 2:
 Number of entries: 7.
  254   NewSubfileType                  LONG
1                     1
  256   ImageWidth                      LONG          1
2341
  257   ImageLength                     LONG          1
1648
  282   XResolution                 RATIONAL          1
*0x7c9d8
          [0]                  50/1
  283   YResolution                 RATIONAL          1
*0x7c9e0
          [0]                  50/1
  324   TileOffsets                     LONG         20
*0x7c9e8
          [0]      36688      40008      42518      44526
          [4]      46418      47068      50636      54192
          [8]      58156      63442      68644      73024
         [12]      76998      78496      86516      92818
         [16]      93116      93492      93874      95876
  325   TileByteCounts                  LONG         20
*0x7ca38
          [0]       3320       2510       2008       1892
          [4]        650       3568       3556       3964
          [8]       5286       5202       4380       3974
         [12]       1498       8020       6302        298
         [16]        376        382       2002       1469
 Offset to next IFD: 0x7ca88.
IFD 3:
 Number of entries: 7.
  254   NewSubfileType                  LONG
1                     1
  256   ImageWidth                      LONG          1
1171
  257   ImageLength                     LONG
1                   824
  282   XResolution                 RATIONAL          1
*0x7cb0c
          [0]                  25/1
  283   YResolution                 RATIONAL          1
*0x7cb14
          [0]                  25/1
  324   TileOffsets                     LONG          6
*0x7cb1c
          [0]      12803      18571      23963      25963
          [4]      29905      33711
  325   TileByteCounts                  LONG          6
*0x7cb34
          [0]       5768       5392       2000       3942
          [4]       3806       2977
 Offset to next IFD: 0x7cb4c.
IFD 4:
 Number of entries: 7.
  254   NewSubfileType                  LONG
1                     1
  256   ImageWidth                      LONG
1                   586
  257   ImageLength                     LONG
1                   412
  282   XResolution                 RATIONAL          1
*0x7cbd0
          [0]                  25/2
  283   YResolution                 RATIONAL          1
*0x7cbd8
          [0]                  25/2
  324   TileOffsets                     LONG          2
*0x7cbe0
          [0]       3739      11057
  325   TileByteCounts                  LONG          2
*0x7cbe8
          [0]       7318       1746
 Offset to next IFD: 0x7cbf0.
IFD 5:
 Number of entries: 7.
  254   NewSubfileType                  LONG
1                     1
  256   ImageWidth                      LONG
1                   293
  257   ImageLength                     LONG
1                   206
  282   XResolution                 RATIONAL          1
*0x7cc74
          [0]                  25/4
  283   YResolution                 RATIONAL          1
*0x7cc7c
          [0]                  25/4
  324   TileOffsets                     LONG
1                   254
  325   TileByteCounts                  LONG          1
3485
 Offset to next IFD: 0 (no more).

TIFF dump: Copyright by Ivo Penzar, 1993.