checkin from browser
authorClaus Gittinger <cg@exept.de>
Fri, 11 Apr 1997 00:42:03 +0200
changeset 516 76ffe180cff8
parent 515 7df33af3beaa
child 517 6658791e40d0
checkin from browser
TIFFRdr.st
TIFFReader.st
--- a/TIFFRdr.st	Sun Apr 06 15:03:43 1997 +0200
+++ b/TIFFRdr.st	Fri Apr 11 00:42:03 1997 +0200
@@ -127,563 +127,865 @@
 
 "/ 'tiffTag: ' print. tagType printCR.
 
-    (numberType == 3) ifTrue:[
-        "short"
+    (numberType == 3 "TIFF_SHORT") ifTrue:[
+        "16 bit ushort"
         valueArray := self readShorts:length.
         value := valueArray at:1
+    ] ifFalse:[(numberType == 4 "TIFF_LONG") ifTrue:[
+        "32 bit uinteger"
+        valueArray := self readLongs:length.
+        value := valueArray at:1
+    ] ifFalse:[(numberType == 2 "TIFF_ASCII") ifTrue:[
+        "ascii characters"
+        value := self readChars:length
+    ] ifFalse:[(numberType == 5 "TIFF_RATIONAL") ifTrue:[
+        "64 bit ufraction"
+        valueArray := self readFracts:length.
+        value := valueArray at:1
     ] ifFalse:[
-        (numberType == 4) ifTrue:[
-            "integer"
-            valueArray := self readLongs:length.
-            value := valueArray at:1
-        ] ifFalse:[
-            (numberType == 2) ifTrue:[
-                "character"
-                value := self readChars:length
-            ] ifFalse:[
-                (numberType == 5) ifTrue:[
-                    "fraction"
-                    valueArray := self readFracts:length.
-                    value := valueArray at:1
-                ] ifFalse:[
-                    offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
-                ]
-            ]
-        ]
-    ].
+        offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
+    ]]]].
+
+    (tagType < 300) ifTrue:[
+        (tagType == 254) ifTrue:[
+            "/ New SubfileType
+            "/      REDUCEDIMAGE    -> 1
+            "/      PAGE            -> 2
+            "/      MASK            -> 4
+            "newSubFileType := value."
 
-    (tagType == 254) ifTrue:[
-        "NewSubfileType"
-        "newSubFileType := value."
+    "/        'newSubfiletype ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 255) ifTrue:[
+            "/ Old SubfileType
+            "/      IMAGE           -> 1
+            "/      REDUCEDIMAGE    -> 2
+            "/      PAGE            -> 3
+            subFileType := value.
+
+    "/        'subfiletype ' print. value printNewline.
 
-"/        'newSubfiletype ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 256) ifTrue:[
+            "ImageWidth"
+            width := value.
 
-        ^ self
-    ].
-    (tagType == 255) ifTrue:[
-        "SubfileType"
-        subFileType := value.
-
-"/        'subfiletype ' print. value printNewline.
+    "/        'width ' print. width printNewline.
 
-        ^ self
-    ].
-    (tagType == 256) ifTrue:[
-        "ImageWidth"
-        width := value.
+            ^ self
+        ].
+        (tagType == 257) ifTrue:[
+            "ImageHeight"
+            height := value.
+
+    "/        'height ' print. height  printNewline.
 
-"/        'width ' print. width printNewline.
+            ^ self
+        ].
+        (tagType == 258) ifTrue:[
+            "bitspersample"
+             bitsPerSample := valueArray.
 
-        ^ self
-    ].
-    (tagType == 257) ifTrue:[
-        "ImageHeight"
-        height := value.
+    "/        'bitspersample ' print. bitsPerSample printNewline.
 
-"/        'height ' print. height  printNewline.
-
-        ^ self
-    ].
-    (tagType == 258) ifTrue:[
-        "bitspersample"
-         bitsPerSample := valueArray.
-
-"/        'bitspersample ' print. bitsPerSample printNewline.
+            ^ self
+        ].
+        (tagType == 259) ifTrue:[
+            "/ compression
+            "/      NONE            -> 1
+            "/      CCITTRLE        -> 2
+            "/      CCITTFAX3       -> 3
+            "/      CCITTFAX4       -> 4
+            "/      LZW             -> 5
+            "/      OJPEG           -> 6
+            "/      JPEG            -> 7
+            "/      NEXT            -> 32766
+            "/      CCITTRLEW       -> 32771
+            "/      PACKBITS        -> 32809
+            "/      PIXARFILM       -> 32908
+            "/      PIXARLOG        -> 32909
+            "/      DEFLATE         -> 32946
+            "/      DCS             -> 32947
+            "/      JBIG            -> 34661
+            
+            compression := value.
 
-        ^ self
-    ].
-    (tagType == 259) ifTrue:[
-        "compression"
-        compression := value.
-
-"/        'compression ' print. compression printNewline.
-
-        ^ self
-    ].
-    (tagType == 262) ifTrue:[
-        "photometric"
+    "/        'compression ' print. compression printNewline.
 
-        (value == 0) ifTrue:[
-          photometric := #whiteIs0
-        ] ifFalse:[
-          (value == 1) ifTrue:[
-            photometric := #blackIs0
-          ] ifFalse:[
-            (value == 2) ifTrue:[
-              photometric := #rgb
+            ^ self
+        ].
+        (tagType == 262) ifTrue:[
+            "photometric"
+
+            (value == 0) ifTrue:[
+              photometric := #whiteIs0
             ] ifFalse:[
-              (value == 3) ifTrue:[
-                photometric := #palette
+              (value == 1) ifTrue:[
+                photometric := #blackIs0
               ] ifFalse:[
-                (value == 4) ifTrue:[
-                  photometric := #transparency
+                (value == 2) ifTrue:[
+                  photometric := #rgb
                 ] ifFalse:[
-                  (value == 5) ifTrue:[
-                    photometric := #separated  "/ color separations
+                  (value == 3) ifTrue:[
+                    photometric := #palette
                   ] ifFalse:[
-                    (value == 6) ifTrue:[
-                      photometric := #ycbr    "/ CCIR 601
+                    (value == 4) ifTrue:[
+                      photometric := #transparency
                     ] ifFalse:[
-                      (value == 8) ifTrue:[
-                        photometric := #cielab  "/ 1976 CIE L*a*b*
+                      (value == 5) ifTrue:[
+                        photometric := #separated  "/ color separations
                       ] ifFalse:[
-                        photometric := nil
+                        (value == 6) ifTrue:[
+                          photometric := #ycbr    "/ CCIR 601
+                        ] ifFalse:[
+                          (value == 8) ifTrue:[
+                            photometric := #cielab  "/ 1976 CIE L*a*b*
+                          ] ifFalse:[
+                            photometric := nil
+                          ]
+                        ]
                       ]
                     ]
                   ]
                 ]
               ]
-            ]
-          ]
+            ].
+
+    "/        'photometric ' print. photometric printNewline.
+
+            ^ self
         ].
+        (tagType == 263) ifTrue:[
+            "/ Treshholding
+            "/      BILEVEL         -> 1
+            "/      HALFTONE        -> 2
+            "/      ERRORDIFFUSE    -> 3
 
-"/        'photometric ' print. photometric printNewline.
+            "threshholding := value."
+
+    "/        'treshholding ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 264) ifTrue:[
+            "CellWidth"
+            "cellWidth:= value."
+
+    "/        'cellWidth ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 265) ifTrue:[
+            "CellLength"
+            "cellLength:= value."
+
+    "/        'cellLength ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 263) ifTrue:[
-        "Treshholding"
-        "threshholding := value."
+            ^ self
+        ].
+        (tagType == 266) ifTrue:[
+            "fillOrder"
+            (value == 1) ifTrue:[
+              fillOrder := #msb
+            ] ifFalse:[
+              (value == 2) ifTrue:[
+                fillOrder := #lsb
+              ] ifFalse:[
+                fillOrder := nil
+              ]
+            ].
+
+    "/        'fillorder ' print. fillOrder printNewline.
 
-"/        'treshholding ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 269) ifTrue:[
+            "documentName - info only"
+
+    "/        'documentName ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 270) ifTrue:[
+            "imageDescription - info only"
+
+    "/        'imageDescription ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 271) ifTrue:[
+            "make - info only"
 
-        ^ self
-    ].
-    (tagType == 264) ifTrue:[
-        "CellWidth"
-        "cellWidth:= value."
+    "/        'make ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 272) ifTrue:[
+            "model - info only"
+
+    "/        'model ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 273) ifTrue:[
+            "stripoffsets"
+            stripOffsets := valueArray.
 
-"/        'cellWidth ' print. value printNewline.
+    "/        'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
+
+            ^ self
+        ].
+        (tagType == 274) ifTrue:[
+            "Orientation"
+
+            orientation :=
+                            #( nil          "/ 1 normal (topLeft)
+                               unsupported  "/ 2 horizontal flip
+                               unsupported  "/ 3 horizontal & vertical flip
+                               vFlip        "/ 4 vertical flip
+                               unsupported  "/ 5 rot 90' counter clock-wise
+                               unsupported  "/ 6 rot 90' clock-wise
+                               unsupported  "/ 7 rot 90' & flip
+                               unsupported  "/ 8 rot 90' ccw & flip
+                             ) at:value ifAbsent:#unsupported.
 
-        ^ self
-    ].
-    (tagType == 265) ifTrue:[
-        "CellLength"
-        "cellLength:= value."
+    "/        'orientation ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 277) ifTrue:[
+            "samplesPerPixel"
+            samplesPerPixel := value.
+
+    "/        'samplesperpixel ' print. samplesPerPixel printNewline.
+
+            ^ self
+        ].
+        (tagType == 278) ifTrue:[
+            "rowsperstrip"
+            rowsPerStrip := value.
+
+    "/        'rowsperstrip ' print. rowsPerStrip printNewline.
 
-"/        'cellLength ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 279) ifTrue:[
+            "stripbytecount"
+            stripByteCounts := valueArray.
+
+    "/        'stripByteCounts Array(' print. 
+    "/        stripByteCounts size print.
+    "/        ')' printNewline.
+
+            ^ self
+        ].
+        (tagType == 280) ifTrue:[
+            "MinSampleValue"
+            "minSampleValue:= value."
+
+    "/        'minSampleValue ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 266) ifTrue:[
-        "fillOrder"
-        (value == 1) ifTrue:[
-          fillOrder := #msb
-        ] ifFalse:[
-          (value == 2) ifTrue:[
-            fillOrder := #lsb
-          ] ifFalse:[
-            fillOrder := nil
-          ]
+            ^ self
+        ].
+        (tagType == 281) ifTrue:[
+            "MaxSampleValue"
+            "maxSampleValue:= value."
+
+    "/        'maxSampleValue ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 282) ifTrue:[
+            "xResolution"
+
+    "/        'xres ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 283) ifTrue:[
+            "yResolution"
+
+    "/        'yres ' print. value printNewline.
+
+            ^ self
         ].
+        (tagType == 284) ifTrue:[
+            "planarconfig"
+            (value == 1) ifTrue:[
+              planarConfiguration := 1
+            ] ifFalse:[
+              (value == 2) ifTrue:[
+                planarConfiguration := 2
+              ] ifFalse:[
+                planarConfiguration := nil
+              ]
+            ].
 
-"/        'fillorder ' print. fillOrder printNewline.
+    "/        'planarconfig ' print. planarConfiguration printNewline.
+
+            ^ self
+        ].
+        (tagType == 285) ifTrue:[
+            "pageName"
+
+    "/        'pageName ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 269) ifTrue:[
-        "documentName - info only"
+            ^ self
+        ].
+        (tagType == 286) ifTrue:[
+            "xPosition"
+
+    "/        'xPos ' print. value printNewline.
 
-"/        'documentName ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 287) ifTrue:[
+            "yPosition"
+
+    "/        'yPos ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 288) ifTrue:[
+            "freeOffsets"
+
+    "/        'freeOffsets ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 270) ifTrue:[
-        "imageDescription - info only"
+            ^ self
+        ].
+        (tagType == 289) ifTrue:[
+            "freeByteCounts"
+
+    "/        'freeByteCounts ' print. value printNewline.
 
-"/        'imageDescription ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 290) ifTrue:[
+            "grayResponceUnit"
+
+    "/        'grayResponceUnit' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 271) ifTrue:[
-        "make - info only"
+            ^ self
+        ].
+        (tagType == 291) ifTrue:[
+            "grayResponceCurve"
+
+    "/        'grayResponceCurve' print. value printNewline.
 
-"/        'make ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 292) ifTrue:[
+            "/ group3options
+            "/      2DENCODING      -> 1
+            "/      UNCOMPRESSED    -> 2
+            "/      FILLBITS        -> 4
+
+            group3options := value.
+
+    "/        'group3options ' print. group3options printNewline.
 
-        ^ self
-    ].
-    (tagType == 272) ifTrue:[
-        "model - info only"
+            ^ self
+        ].
+        (tagType == 293) ifTrue:[
+            "/ group4options
+            "/      UNCOMPRESSED    -> 2
 
-"/        'model ' print. value printNewline.
+            "group4options := value."
+
+    "/        'group4options ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 296) ifTrue:[
+            "resolutionunit"
 
-        ^ self
-    ].
-    (tagType == 273) ifTrue:[
-        "stripoffsets"
-        stripOffsets := valueArray.
+    "/        (value == 1) ifTrue:[
+    "/            'res-unit pixel' printNewline
+    "/        ] ifFalse:[
+    "/            (value == 2) ifTrue:[
+    "/                'res-unit inch' printNewline
+    "/            ] ifFalse:[
+    "/                (value == 3) ifTrue:[
+    "/                    'res-unit mm' printNewline
+    "/                ] ifFalse:[
+    "/                    'res-unit invalid' printNewline
+    "/                ]
+    "/            ]
+    "/        ].
 
-"/        'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
+            "resolutionUnit := value."
+            ^ self
+        ].
+        (tagType == 297) ifTrue:[
+            "pageNumber"
+            "pageNumber := value."
 
-        ^ self
+    "/        'pageNumber ' print. value printNewline.
+
+            ^ self
+        ].
     ].
-    (tagType == 274) ifTrue:[
-        "Orientation"
+
+    (tagType < 400) ifTrue:[
+        (tagType == 300) ifTrue:[
+            "colorResponceUnit"
+
+    "/        'colorResponceUnit' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 301) ifTrue:[
+            "colorResponceCurve"
+
+    "/        'colorResponceCurve' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 305) ifTrue:[
+            "software - info only"
+
+    "/        'software' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 306) ifTrue:[
+            "dateTime - info only"
+
+    "/        'dateTime ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 315) ifTrue:[
+            "artist - info only"
 
-        orientation :=
-                        #( nil          "/ 1 normal
-                           unsupported  "/ 2 horizontal flip
-                           unsupported  "/ 3 horizontal & vertical flip
-                           vFlip        "/ 4 vertical flip
-                           unsupported  "/ 5 rot 90' counter clock-wise
-                           unsupported  "/ 6 rot 90' clock-wise
-                           unsupported  "/ 7 rot 90' & flip
-                           unsupported  "/ 8 rot 90' ccw & flip
-                         ) at:value ifAbsent:#unsupported.
+    "/        'artist ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 316) ifTrue:[
+            "host computer - info only"
+
+    "/        'host ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 317) ifTrue:[
+            "predictor"
+            predictor := value.
+
+    "/        'predictor ' print. predictor printNewline.
 
-"/        'orientation ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 318) ifTrue:[
+            "whitePoint"
+
+    "/        'whitePoint ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 319) ifTrue:[
+            "primaryChromatics"
+
+    "/        'primaryChromatics ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 320) ifTrue:[
+            "colorMap"
 
-        ^ self
-    ].
-    (tagType == 277) ifTrue:[
-        "samplesPerPixel"
-        samplesPerPixel := value.
+    "/        'colorMap (size=' print. valueArray size print. ')' printNewline.
+
+            "
+             the tiff colormap contains 16bit values;
+             our colormap expects 8bit values
+            "
+            n := valueArray size // 3.
 
-"/        'samplesperpixel ' print. samplesPerPixel printNewline.
+            rV := ByteArray uninitializedNew:n.
+            gV := ByteArray uninitializedNew:n.
+            bV := ByteArray uninitializedNew:n.
+            scaleFactor := 255.0 / 16rFFFF.
+            i2 := n+1.
+            i3 := 2*n+1.
+            1 to:n do:[:vi |
+                val := ((valueArray at:vi) * scaleFactor) rounded.
+                rV at:vi put:val.
+                val := ((valueArray at:i2) * scaleFactor) rounded.
+                gV at:vi put:val.
+                val := ((valueArray at:i3) * scaleFactor) rounded.
+                bV at:vi put:val.
+                i2 := i2 + 1.
+                i3 := i3 + 1.
+            ].
+            colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
+            ^ self
+        ].
+        (tagType == 321) ifTrue:[
+            "halftonehints"
+
+    "/        'halftonehints' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 278) ifTrue:[
-        "rowsperstrip"
-        rowsPerStrip := value.
+            ^ self
+        ].
+        (tagType == 322) ifTrue:[
+            "tilewidth"
+
+    "/        'tilewidth' print. value printNewline.
 
-"/        'rowsperstrip ' print. rowsPerStrip printNewline.
+            ^ self
+        ].
+        (tagType == 323) ifTrue:[
+            "tilelength"
+
+    "/        'tilelength' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 324) ifTrue:[
+            "tileoffsets"
 
-        ^ self
-    ].
-    (tagType == 279) ifTrue:[
-        "stripbytecount"
-        stripByteCounts := valueArray.
+    "/        'tileoffsets' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 325) ifTrue:[
+            "tilebytecounts"
+
+    "/        'tilebytecounts' print. value printNewline.
 
-"/        'stripByteCounts Array(' print. 
-"/        stripByteCounts size print.
-"/        ')' printNewline.
+            ^ self
+        ].
+        (tagType == 327) ifTrue:[
+            "cleanfaxdata"
+
+    "/        'tilebytecounts' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 328) ifTrue:[
+            "consecutiveBadFaxLines"
 
-        ^ self
-    ].
-    (tagType == 280) ifTrue:[
-        "MinSampleValue"
-        "minSampleValue:= value."
+    "/        'consecutiveBadFaxLines' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 330) ifTrue:[
+            "subifd"
+
+    "/        'subifd' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 332) ifTrue:[
+            "ink set"
+
+    "/        'ink set' print. value printNewline.
 
-"/        'minSampleValue ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 333) ifTrue:[
+            "ink names"
+
+    "/        'ink names' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 336) ifTrue:[
+            "dot range"
+
+    "/        'dot range' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 337) ifTrue:[
+            "target printer"
 
-        ^ self
-    ].
-    (tagType == 281) ifTrue:[
-        "MaxSampleValue"
-        "maxSampleValue:= value."
+    "/        'target printer' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 338) ifTrue:[
+            "extrasamples"
+
+    "/        'extrasamples' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 339) ifTrue:[
+            "sample format"
+
+    "/        'sample format' print. value printNewline.
 
-"/        'maxSampleValue ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 340) ifTrue:[
+            "min sample value"
+
+    "/        'min sample value' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 282) ifTrue:[
-        "xResolution"
+            ^ self
+        ].
+        (tagType == 341) ifTrue:[
+            "max sample value"
+
+    "/        'max sample value' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 347) ifTrue:[
+            "jpegtables"
 
-"/        'xres ' print. value printNewline.
+    "/        'jpegtables' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 283) ifTrue:[
-        "yResolution"
-
-"/        'yres ' print. value printNewline.
-
-        ^ self
+            ^ self
+        ].
     ].
-    (tagType == 284) ifTrue:[
-        "planarconfig"
-        (value == 1) ifTrue:[
-          planarConfiguration := 1
-        ] ifFalse:[
-          (value == 2) ifTrue:[
-            planarConfiguration := 2
-          ] ifFalse:[
-            planarConfiguration := nil
-          ]
+
+    (tagType < 600) ifTrue:[
+        "/ obsolete JPEG tags
+        (tagType == 512) ifTrue:[
+            "jpeg proc"
+
+    "/        'jpeg proc' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 513) ifTrue:[
+            "jpeg proc"
+
+    "/        'jpeg proc' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 514) ifTrue:[
+            "jpeg ifByteCount"
+
+    "/        'jpeg ifByteCount' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 515) ifTrue:[
+            "jpeg restartInterval"
+
+    "/        'jpeg restartInterval' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 517) ifTrue:[
+            "jpeg glossLessPredictors"
+
+    "/        'jpeg glossLessPredictors' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 518) ifTrue:[
+            "jpeg pointTransform"
+
+    "/        'jpeg pointTransform' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 519) ifTrue:[
+            "jpeg qTables"
+
+    "/        'jpeg qTables' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 520) ifTrue:[
+            "jpeg dcTables"
+
+    "/        'jpeg dcTables' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 521) ifTrue:[
+            "jpeg acTables"
+
+    "/        'jpeg acTables' print. value printNewline.
+
+            ^ self
         ].
 
-"/        'planarconfig ' print. planarConfiguration printNewline.
-
-        ^ self
-    ].
-    (tagType == 285) ifTrue:[
-        "pageName"
-
-"/        'pageName ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 286) ifTrue:[
-        "xPosition"
 
-"/        'xPos ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 287) ifTrue:[
-        "yPosition"
+        (tagType == 529) ifTrue:[
+            "ycbr coeff"
 
-"/        'yPos ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 288) ifTrue:[
-        "freeOffsets"
-
-"/        'freeOffsets ' print. value printNewline.
+    "/        'ycbr coeff' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 289) ifTrue:[
-        "freeByteCounts"
-
-"/        'freeByteCounts ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 290) ifTrue:[
-        "grayResponceUnit"
-
-"/        'grayResponceUnit' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 530) ifTrue:[
+            "ycbr subsampling"
 
-        ^ self
-    ].
-    (tagType == 291) ifTrue:[
-        "grayResponceCurve"
-
-"/        'grayResponceCurve' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 292) ifTrue:[
-        "group3options"
-        group3options := value.
-
-"/        'group3options ' print. group3options printNewline.
-
-        ^ self
-    ].
-    (tagType == 293) ifTrue:[
-        "group4options"
-        "group4options := value."
-
-"/        'group4options ' print. value printNewline.
+    "/        'ycbr subsampling' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 296) ifTrue:[
-        "resolutionunit"
+            ^ self
+        ].
+        (tagType == 531) ifTrue:[
+            "ycbr positioning"
 
-"/        (value == 1) ifTrue:[
-"/            'res-unit pixel' printNewline
-"/        ] ifFalse:[
-"/            (value == 2) ifTrue:[
-"/                'res-unit inch' printNewline
-"/            ] ifFalse:[
-"/                (value == 3) ifTrue:[
-"/                    'res-unit mm' printNewline
-"/                ] ifFalse:[
-"/                    'res-unit invalid' printNewline
-"/                ]
-"/            ]
-"/        ].
-
-        "resolutionUnit := value."
-        ^ self
-    ].
-    (tagType == 297) ifTrue:[
-        "pageNumber"
-        "pageNumber := value."
-
-"/        'pageNumber ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 300) ifTrue:[
-        "colorResponceUnit"
-
-"/        'colorResponceUnit' print. value printNewline.
+    "/        'ycbr positioning' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 301) ifTrue:[
-        "colorResponceCurve"
-
-"/        'colorResponceCurve' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 305) ifTrue:[
-        "software - info only"
-
-"/        'software' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 532) ifTrue:[
+            "referenceBlackWhite"
 
-        ^ self
-    ].
-    (tagType == 306) ifTrue:[
-        "dateTime - info only"
-
-"/        'dateTime ' print. value printNewline.
+    "/        'ycbr positioning' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 315) ifTrue:[
-        "artist - info only"
-
-"/        'artist ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 316) ifTrue:[
-        "host computer - info only"
-
-"/        'host ' print. value printNewline.
-
-        ^ self
+            ^ self
+        ].
     ].
-    (tagType == 317) ifTrue:[
-        "predictor"
-        predictor := value.
+
+    (tagType > 32000) ifTrue:[
 
-"/        'predictor ' print. predictor printNewline.
+        "/ Private Island graphics tags
+        (tagType == 32953) ifTrue:[
+            "ref points"
 
-        ^ self
-    ].
-    (tagType == 318) ifTrue:[
-        "whitePoint"
+    "/        'ref points' print. value printNewline.
 
-"/        'whitePoint ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 32954) ifTrue:[
+            "regionTagPoint"
+
+    "/        'regionTagPoint' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 319) ifTrue:[
-        "primaryChromatics"
+            ^ self
+        ].
+        (tagType == 32955) ifTrue:[
+            "regionWarpCorners"
 
-"/        'primaryChromatics ' print. value printNewline.
+    "/        'regionWarpCorners' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 320) ifTrue:[
-        "colorMap"
+            ^ self
+        ].
+        (tagType == 32956) ifTrue:[
+            "regionAffine"
 
-"/        'colorMap (size=' print. valueArray size print. ')' printNewline.
+    "/        'regionAffine' print. value printNewline.
 
-        "
-         the tiff colormap contains 16bit values;
-         our colormap expects 8bit values
-        "
-        n := valueArray size // 3.
+            ^ self
+        ].
+
+
+        "/ Private SGI tags
 
-        rV := ByteArray uninitializedNew:n.
-        gV := ByteArray uninitializedNew:n.
-        bV := ByteArray uninitializedNew:n.
-        scaleFactor := 255.0 / 16rFFFF.
-        i2 := n+1.
-        i3 := 2*n+1.
-        1 to:n do:[:vi |
-            val := ((valueArray at:vi) * scaleFactor) rounded.
-            rV at:vi put:val.
-            val := ((valueArray at:i2) * scaleFactor) rounded.
-            gV at:vi put:val.
-            val := ((valueArray at:i3) * scaleFactor) rounded.
-            bV at:vi put:val.
-            i2 := i2 + 1.
-            i3 := i3 + 1.
+        (tagType == 32995) ifTrue:[
+            "matteing"
+
+    "/        'matteing' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 32996) ifTrue:[
+            "datatype"
+
+    "/        'datatype' print. value printNewline.
+
+            ^ self
         ].
-        colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
-        ^ self
-    ].
-    (tagType == 332) ifTrue:[
-        "ink set"
+        (tagType == 32997) ifTrue:[
+            "imagedepth"
+
+    "/        'imagedepth' print. value printNewline.
 
-"/        'ink set' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 32998) ifTrue:[
+            "tiledepth"
 
-        ^ self
-    ].
-    (tagType == 333) ifTrue:[
-        "ink names"
+    "/        'tiledepth' print. value printNewline.
 
-"/        'ink names' print. value printNewline.
+            ^ self
+        ].
 
-        ^ self
-    ].
-    (tagType == 336) ifTrue:[
-        "dot range"
+        "/ Private Pixar tags
 
-"/        'dot range' print. value printNewline.
+        (tagType == 33300) ifTrue:[
+            "image full width"
+
+    "/        'image full width' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 337) ifTrue:[
-        "target printer"
+            ^ self
+        ].
+        (tagType == 33301) ifTrue:[
+            "image full length"
 
-"/        'target printer' print. value printNewline.
+    "/        'image full length' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 339) ifTrue:[
-        "sample format"
+            ^ self
+        ].
+
+        "/ Private Eastman Kodak tags
 
-"/        'sample format' print. value printNewline.
+        (tagType == 33405) ifTrue:[
+            "write serial number"
+
+    "/        'write serial number' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 340) ifTrue:[
-        "min sample value"
+            ^ self
+        ].
+
+        "/ unknown
 
-"/        'min sample value' print. value printNewline.
+        (tagType == 33432) ifTrue:[
+            "copyright"
+
+    "/        'copyright' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 341) ifTrue:[
-        "max sample value"
+            ^ self
+        ].
 
-"/        'max sample value' print. value printNewline.
+        "/ Private Texas instruments
 
-        ^ self
-    ].
-    (tagType == 512) ifTrue:[
-        "jpeg proc"
+        (tagType == 34232) ifTrue:[
+            "sequence frame count"
 
-"/        'jpeg proc' print. value printNewline.
+    "/        'sequence frame count' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 513) ifTrue:[
-        "jpeg proc"
+            ^ self
+        ].
 
-"/        'jpeg proc' print. value printNewline.
+        "/ Private Pixel magic
+
+        (tagType == 34232) ifTrue:[
+            "jbig options"
 
-        ^ self
-    ].
-    (tagType == 32995) ifTrue:[
-        "matteing"
+    "/        'jbig options' print. value printNewline.
+
+            ^ self
+        ].
 
-"/        'matteing' print. value printNewline.
+        "/ More Private SGI
+
+        (tagType == 34908) ifTrue:[
+            "fax recv params"
 
-        ^ self
-    ].
-    (tagType == 32996) ifTrue:[
-        "datatype"
+    "/        'fax recv params' print. value printNewline.
 
-"/        'datatype' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 34909) ifTrue:[
+            "fax subaddress"
+
+    "/        'fax subaddress' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 32997) ifTrue:[
-        "imagedepth"
-
-"/        'imagedepth' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 34910) ifTrue:[
+            "fax recv time"
 
-        ^ self
-    ].
-    (tagType == 32998) ifTrue:[
-        "tiledepth"
+    "/        'fax recv time' print. value printNewline.
 
-"/        'tiledepth' print. value printNewline.
-
-        ^ self
+            ^ self
+        ].
     ].
 
 "/
@@ -693,10 +995,10 @@
 "/
     'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
 
-    "Modified: 31.1.1997 / 10:50:38 / cg"
+    "Modified: 11.4.1997 / 00:17:13 / cg"
 ! !
 
-!TIFFReader methodsFor:'private - reading'!
+!TIFFReader methodsFor:'private - data reading'!
 
 readCCITT3RLETiffImageData
      'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR.
@@ -777,48 +1079,25 @@
     "Modified: 10.1.1997 / 19:10:59 / cg"
 !
 
-readChars:n
-    "read n characters and return them in a string"
-
-    |oldPos offset string|
-
-    n == 0 ifTrue:[^ ''].
+readDCSTiffImageData
+    'TIFFReader [warning]: dcs compression not implemented' errorPrintCR
 
-    string := String new:(n - 1).
-    (n <= 4) ifTrue:[
-        inStream nextBytes:(n - 1) into:string
-    ] ifFalse:[
-        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
-        oldPos := inStream position.
-        inStream position:(offset + 1).
-        inStream nextBytes:(n - 1) into:string.
-        inStream position:oldPos
-    ].
-    ^ string
-
-    "Modified: 5.9.1996 / 12:21:08 / cg"
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:54 / cg"
 !
 
-readFracts:nFracts
-    "read nFracts fractions (2 32bit words) and return them in an array"
-
-    |oldPos offset values numerator denominator msb
-     n "{ Class: SmallInteger }" |
-
-    n := nFracts.
+readDeflateTiffImageData
+    'TIFFReader [warning]: deflate compression not implemented' errorPrintCR
 
-    msb := byteOrder ~~ #lsb.
-    values := Array basicNew:n.
-    offset := inStream nextLongMSB:msb.
-    oldPos := inStream position.
-    inStream position:(offset + 1).
-    1 to:n do:[:index |
-	numerator := inStream nextLongMSB:msb.
-	denominator := inStream nextLongMSB:msb.
-	values at:index put:(Fraction numerator:numerator denominator:denominator)
-    ].
-    inStream position:oldPos.
-    ^ values
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:45 / cg"
+!
+
+readJBIGTiffImageData
+    'TIFFReader [warning]: jbig compression not implemented' errorPrintCR
+
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:31:00 / cg"
 !
 
 readJPEGTiffImageData
@@ -908,30 +1187,6 @@
     "Modified: 10.1.1997 / 18:13:21 / cg"
 !
 
-readLongs:nLongs
-    "read nLongs long numbers (32bit) and return them in an array"
-
-    |oldPos offset values msb 
-     n "{ Class: SmallInteger }" |
-
-    n := nLongs.
-
-    msb := byteOrder ~~ #lsb.
-    values := Array basicNew:n.
-    (n == 1) ifTrue:[
-	values at:1 put:(inStream nextLongMSB:msb).
-    ] ifFalse:[
-	offset := inStream nextLongMSB:msb.
-	oldPos := inStream position.
-	inStream position:(offset + 1).
-	1 to:n do:[:index |
-	    values at:index put:(inStream nextLongMSB:msb)
-	].
-	inStream position:oldPos
-    ].
-    ^ values
-!
-
 readNeXTJPEGTiffImageData
     'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR
 
@@ -953,33 +1208,88 @@
     "Modified: 10.1.1997 / 18:10:57 / cg"
 !
 
-readShorts:nShorts
-    "read nShorts short numbers (16bit) and return them in an array"
+readPixarFilmTiffImageData
+    'TIFFReader [warning]: pixar film compression not implemented' errorPrintCR
 
-    |oldPos offset values msb val2
-     n "{ Class: SmallInteger }" |
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:33 / cg"
+!
+
+readPixarLogTiffImageData
+    'TIFFReader [warning]: pixar log compression not implemented' errorPrintCR
 
-    n := nShorts.
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:39 / cg"
+!
 
-    msb := (byteOrder ~~ #lsb).
-    values := Array basicNew:n.
-    (n <= 2) ifTrue:[
-	values at:1 put:(inStream nextUnsignedShortMSB:msb).
-	val2 := inStream nextUnsignedShortMSB:msb.
+readThunderScanTiffImageData
+    'TIFFReader [warning]: thunderScan compression not implemented' errorPrintCR
+
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:23 / cg"
+!
 
-	(n == 2) ifTrue:[
-	    values at:2 put:val2
-	]
-    ] ifFalse:[
-	offset := inStream nextLongMSB:msb.
-	oldPos := inStream position.
-	inStream position:(offset + 1).
-	1 to:n do:[:index |
-	    values at:index put:(inStream nextUnsignedShortMSB:msb)
-	].
-	inStream position:oldPos
+readTiffImageData
+    (compression == 1) ifTrue:[
+        ^ self readUncompressedTiffImageData.
+    ].
+    (compression == 2) ifTrue:[
+        ^ self readCCITT3RLETiffImageData.
+    ].
+    (compression == 3) ifTrue:[
+        ^ self readCCITTGroup3TiffImageData.
+    ]. 
+    (compression == 4) ifTrue:[
+        ^ self readCCITTGroup4TiffImageData.
+    ]. 
+    (compression == 5) ifTrue:[
+        ^ self readLZWTiffImageData.
+    ].
+    (compression == 6) ifTrue:[
+        ^ self readJPEGTiffImageData.
+    ].
+    (compression == 7) ifTrue:[
+        ^ self readNewJPEGTiffImageData.
+    ].
+
+    (compression == 32766) ifTrue:[
+        ^ self readNeXTRLE2TiffImageData.
+    ].
+    (compression == 32771) ifTrue:[
+        ^ self readCCITTRLEWTiffImageData.
     ].
-    ^ values
+    (compression == 32773) ifTrue:[
+        ^ self readPackbitsTiffImageData.
+    ].
+    (compression == 32809) ifTrue:[
+        ^ self readThunderScanTiffImageData.
+    ].
+    (compression == 32908) ifTrue:[
+        ^ self readPixarFilmTiffImageData.
+    ].
+    (compression == 32909) ifTrue:[
+        ^ self readPixarLogTiffImageData.
+    ].
+    (compression == 32946) ifTrue:[
+        ^ self readDeflateTiffImageData.
+    ].
+    (compression == 32947) ifTrue:[
+        ^ self readDCSTiffImageData.
+    ].
+    (compression == 32865) ifTrue:[
+        ^ self readNeXTJPEGTiffImageData.
+    ].
+    (compression == 34661) ifTrue:[
+        ^ self readJBIGTiffImageData.
+    ].
+
+    'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
+    ' not known' errorPrintCR.
+
+    ^ nil.
+
+    "Created: 11.4.1997 / 00:19:44 / cg"
+    "Modified: 11.4.1997 / 00:29:54 / cg"
 !
 
 readUncompressedTiffImageData
@@ -1056,6 +1366,105 @@
     "Modified: 10.1.1997 / 18:10:46 / cg"
 ! !
 
+!TIFFReader methodsFor:'private - reading'!
+
+readChars:n
+    "read n characters and return them in a string"
+
+    |oldPos offset string|
+
+    n == 0 ifTrue:[^ ''].
+
+    string := String new:(n - 1).
+    (n <= 4) ifTrue:[
+        inStream nextBytes:(n - 1) into:string
+    ] ifFalse:[
+        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
+        oldPos := inStream position.
+        inStream position:(offset + 1).
+        inStream nextBytes:(n - 1) into:string.
+        inStream position:oldPos
+    ].
+    ^ string
+
+    "Modified: 5.9.1996 / 12:21:08 / cg"
+!
+
+readFracts:nFracts
+    "read nFracts fractions (2 32bit words) and return them in an array"
+
+    |oldPos offset values numerator denominator msb
+     n "{ Class: SmallInteger }" |
+
+    n := nFracts.
+
+    msb := byteOrder ~~ #lsb.
+    values := Array basicNew:n.
+    offset := inStream nextLongMSB:msb.
+    oldPos := inStream position.
+    inStream position:(offset + 1).
+    1 to:n do:[:index |
+	numerator := inStream nextLongMSB:msb.
+	denominator := inStream nextLongMSB:msb.
+	values at:index put:(Fraction numerator:numerator denominator:denominator)
+    ].
+    inStream position:oldPos.
+    ^ values
+!
+
+readLongs:nLongs
+    "read nLongs long numbers (32bit) and return them in an array"
+
+    |oldPos offset values msb 
+     n "{ Class: SmallInteger }" |
+
+    n := nLongs.
+
+    msb := byteOrder ~~ #lsb.
+    values := Array basicNew:n.
+    (n == 1) ifTrue:[
+	values at:1 put:(inStream nextLongMSB:msb).
+    ] ifFalse:[
+	offset := inStream nextLongMSB:msb.
+	oldPos := inStream position.
+	inStream position:(offset + 1).
+	1 to:n do:[:index |
+	    values at:index put:(inStream nextLongMSB:msb)
+	].
+	inStream position:oldPos
+    ].
+    ^ values
+!
+
+readShorts:nShorts
+    "read nShorts short numbers (16bit) and return them in an array"
+
+    |oldPos offset values msb val2
+     n "{ Class: SmallInteger }" |
+
+    n := nShorts.
+
+    msb := (byteOrder ~~ #lsb).
+    values := Array basicNew:n.
+    (n <= 2) ifTrue:[
+	values at:1 put:(inStream nextUnsignedShortMSB:msb).
+	val2 := inStream nextUnsignedShortMSB:msb.
+
+	(n == 2) ifTrue:[
+	    values at:2 put:val2
+	]
+    ] ifFalse:[
+	offset := inStream nextLongMSB:msb.
+	oldPos := inStream position.
+	inStream position:(offset + 1).
+	1 to:n do:[:index |
+	    values at:index put:(inStream nextUnsignedShortMSB:msb)
+	].
+	inStream position:oldPos
+    ].
+    ^ values
+! !
+
 !TIFFReader methodsFor:'private - writing'!
 
 writeBitsPerSample
@@ -1445,7 +1854,7 @@
      tagType      "{ Class: SmallInteger }"
      numberType   "{ Class: SmallInteger }"
      length       "{ Class: SmallInteger }"
-     result offset ok msb
+     result offset msb
      bitsPerPixel bytesPerRow offset1 offset2 tmp|
 
     inStream := aStream.
@@ -1509,25 +1918,24 @@
     ].
 
     "check for required tags"
-    ok := true.
     width isNil ifTrue:[
         'TIFFReader [warning]: missing width tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     height isNil ifTrue:[
         'TIFFReader [warning]: missing length tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     photometric isNil ifTrue:[
         'TIFFReader [warning]: missing photometric tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     stripOffsets isNil ifTrue:[
         'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     stripByteCounts isNil ifTrue:[
@@ -1538,10 +1946,6 @@
 
     stripByteCounts isNil ifTrue:[
         'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR.
-        ok := false
-    ].
-
-    ok ifFalse:[
         ^ nil
     ].
 
@@ -1555,77 +1959,35 @@
         rowsPerStrip := height
     ].
 
-    ok := false.
-    (compression == 1) ifTrue:[
-        result := self readUncompressedTiffImageData.
-        ok := true
-    ].
-    (compression == 2) ifTrue:[
-        result := self readCCITT3RLETiffImageData.
-        ok := true
-    ].
-    (compression == 3) ifTrue:[
-        result := self readCCITTGroup3TiffImageData.
-        ok := true
-    ]. 
-    (compression == 4) ifTrue:[
-        result := self readCCITTGroup4TiffImageData.
-        ok := true
-    ]. 
-    (compression == 5) ifTrue:[
-        result := self readLZWTiffImageData.
-        ok := true
-    ].
-    (compression == 6) ifTrue:[
-        result := self readJPEGTiffImageData.
-        ok := true
-    ].
-    (compression == 32766) ifTrue:[
-        result := self readNeXTRLE2TiffImageData.
-        ok := true
-    ].
-    (compression == 32771) ifTrue:[
-        result := self readCCITTRLEWTiffImageData.
-        ok := true
-    ].
-    (compression == 32773) ifTrue:[
-        result := self readPackbitsTiffImageData.
-        ok := true
-    ].
-    (compression == 32865) ifTrue:[
-        result := self readNeXTJPEGTiffImageData.
-        ok := true
-    ].
-    ok ifFalse:[
-        'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
-        ' not known' errorPrintCR
-    ].
+    result := self readTiffImageData.
+    result notNil ifTrue:[
+
+        orientation == #vFlip ifTrue:[
+            "/ reverse rows to top-to bottom
 
-    orientation == #vFlip ifTrue:[
-        "/ reverse rows to top-to bottom
-
-        bytesPerRow := self bytesPerRow.
-        tmp := ByteArray new:bytesPerRow.
-        offset1 := 1.
-        offset2 := (height-1)*bytesPerRow + 1.
-        0 to:(height-1//2) do:[:row |
-            tmp replaceFrom:1 to:bytesPerRow
-                with:data startingAt:offset1.
-            data replaceFrom:offset1 to:offset1+bytesPerRow-1
-                 with:data startingAt:offset2.
-            data replaceFrom:offset2 to:offset2+bytesPerRow-1
-                 with:tmp startingAt:1.
-            offset1 := offset1 + bytesPerRow.
-            offset2 := offset2 - bytesPerRow.
+            bytesPerRow := self bytesPerRow.
+            tmp := ByteArray new:bytesPerRow.
+            offset1 := 1.
+            offset2 := (height-1)*bytesPerRow + 1.
+            0 to:(height-1//2) do:[:row |
+                tmp replaceFrom:1 to:bytesPerRow
+                    with:data startingAt:offset1.
+                data replaceFrom:offset1 to:offset1+bytesPerRow-1
+                     with:data startingAt:offset2.
+                data replaceFrom:offset2 to:offset2+bytesPerRow-1
+                     with:tmp startingAt:1.
+                offset1 := offset1 + bytesPerRow.
+                offset2 := offset2 - bytesPerRow.
+            ].
         ].
-    ].
-    orientation == #unsupported ifTrue:[
-        'TIFFReader [warning]: unsupported orientation' errorPrintCR
+        orientation == #unsupported ifTrue:[
+            'TIFFReader [warning]: unsupported orientation' errorPrintCR
+        ].
     ].
 
     ^ result
 
-    "Modified: 31.1.1997 / 10:51:27 / cg"
+    "Modified: 11.4.1997 / 00:21:58 / cg"
 ! !
 
 !TIFFReader methodsFor:'writing to file'!
@@ -1730,6 +2092,6 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.50 1997-02-27 11:50:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.51 1997-04-10 22:42:03 cg Exp $'
 ! !
 TIFFReader initialize!
--- a/TIFFReader.st	Sun Apr 06 15:03:43 1997 +0200
+++ b/TIFFReader.st	Fri Apr 11 00:42:03 1997 +0200
@@ -127,563 +127,865 @@
 
 "/ 'tiffTag: ' print. tagType printCR.
 
-    (numberType == 3) ifTrue:[
-        "short"
+    (numberType == 3 "TIFF_SHORT") ifTrue:[
+        "16 bit ushort"
         valueArray := self readShorts:length.
         value := valueArray at:1
+    ] ifFalse:[(numberType == 4 "TIFF_LONG") ifTrue:[
+        "32 bit uinteger"
+        valueArray := self readLongs:length.
+        value := valueArray at:1
+    ] ifFalse:[(numberType == 2 "TIFF_ASCII") ifTrue:[
+        "ascii characters"
+        value := self readChars:length
+    ] ifFalse:[(numberType == 5 "TIFF_RATIONAL") ifTrue:[
+        "64 bit ufraction"
+        valueArray := self readFracts:length.
+        value := valueArray at:1
     ] ifFalse:[
-        (numberType == 4) ifTrue:[
-            "integer"
-            valueArray := self readLongs:length.
-            value := valueArray at:1
-        ] ifFalse:[
-            (numberType == 2) ifTrue:[
-                "character"
-                value := self readChars:length
-            ] ifFalse:[
-                (numberType == 5) ifTrue:[
-                    "fraction"
-                    valueArray := self readFracts:length.
-                    value := valueArray at:1
-                ] ifFalse:[
-                    offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
-                ]
-            ]
-        ]
-    ].
+        offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
+    ]]]].
+
+    (tagType < 300) ifTrue:[
+        (tagType == 254) ifTrue:[
+            "/ New SubfileType
+            "/      REDUCEDIMAGE    -> 1
+            "/      PAGE            -> 2
+            "/      MASK            -> 4
+            "newSubFileType := value."
 
-    (tagType == 254) ifTrue:[
-        "NewSubfileType"
-        "newSubFileType := value."
+    "/        'newSubfiletype ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 255) ifTrue:[
+            "/ Old SubfileType
+            "/      IMAGE           -> 1
+            "/      REDUCEDIMAGE    -> 2
+            "/      PAGE            -> 3
+            subFileType := value.
+
+    "/        'subfiletype ' print. value printNewline.
 
-"/        'newSubfiletype ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 256) ifTrue:[
+            "ImageWidth"
+            width := value.
 
-        ^ self
-    ].
-    (tagType == 255) ifTrue:[
-        "SubfileType"
-        subFileType := value.
-
-"/        'subfiletype ' print. value printNewline.
+    "/        'width ' print. width printNewline.
 
-        ^ self
-    ].
-    (tagType == 256) ifTrue:[
-        "ImageWidth"
-        width := value.
+            ^ self
+        ].
+        (tagType == 257) ifTrue:[
+            "ImageHeight"
+            height := value.
+
+    "/        'height ' print. height  printNewline.
 
-"/        'width ' print. width printNewline.
+            ^ self
+        ].
+        (tagType == 258) ifTrue:[
+            "bitspersample"
+             bitsPerSample := valueArray.
 
-        ^ self
-    ].
-    (tagType == 257) ifTrue:[
-        "ImageHeight"
-        height := value.
+    "/        'bitspersample ' print. bitsPerSample printNewline.
 
-"/        'height ' print. height  printNewline.
-
-        ^ self
-    ].
-    (tagType == 258) ifTrue:[
-        "bitspersample"
-         bitsPerSample := valueArray.
-
-"/        'bitspersample ' print. bitsPerSample printNewline.
+            ^ self
+        ].
+        (tagType == 259) ifTrue:[
+            "/ compression
+            "/      NONE            -> 1
+            "/      CCITTRLE        -> 2
+            "/      CCITTFAX3       -> 3
+            "/      CCITTFAX4       -> 4
+            "/      LZW             -> 5
+            "/      OJPEG           -> 6
+            "/      JPEG            -> 7
+            "/      NEXT            -> 32766
+            "/      CCITTRLEW       -> 32771
+            "/      PACKBITS        -> 32809
+            "/      PIXARFILM       -> 32908
+            "/      PIXARLOG        -> 32909
+            "/      DEFLATE         -> 32946
+            "/      DCS             -> 32947
+            "/      JBIG            -> 34661
+            
+            compression := value.
 
-        ^ self
-    ].
-    (tagType == 259) ifTrue:[
-        "compression"
-        compression := value.
-
-"/        'compression ' print. compression printNewline.
-
-        ^ self
-    ].
-    (tagType == 262) ifTrue:[
-        "photometric"
+    "/        'compression ' print. compression printNewline.
 
-        (value == 0) ifTrue:[
-          photometric := #whiteIs0
-        ] ifFalse:[
-          (value == 1) ifTrue:[
-            photometric := #blackIs0
-          ] ifFalse:[
-            (value == 2) ifTrue:[
-              photometric := #rgb
+            ^ self
+        ].
+        (tagType == 262) ifTrue:[
+            "photometric"
+
+            (value == 0) ifTrue:[
+              photometric := #whiteIs0
             ] ifFalse:[
-              (value == 3) ifTrue:[
-                photometric := #palette
+              (value == 1) ifTrue:[
+                photometric := #blackIs0
               ] ifFalse:[
-                (value == 4) ifTrue:[
-                  photometric := #transparency
+                (value == 2) ifTrue:[
+                  photometric := #rgb
                 ] ifFalse:[
-                  (value == 5) ifTrue:[
-                    photometric := #separated  "/ color separations
+                  (value == 3) ifTrue:[
+                    photometric := #palette
                   ] ifFalse:[
-                    (value == 6) ifTrue:[
-                      photometric := #ycbr    "/ CCIR 601
+                    (value == 4) ifTrue:[
+                      photometric := #transparency
                     ] ifFalse:[
-                      (value == 8) ifTrue:[
-                        photometric := #cielab  "/ 1976 CIE L*a*b*
+                      (value == 5) ifTrue:[
+                        photometric := #separated  "/ color separations
                       ] ifFalse:[
-                        photometric := nil
+                        (value == 6) ifTrue:[
+                          photometric := #ycbr    "/ CCIR 601
+                        ] ifFalse:[
+                          (value == 8) ifTrue:[
+                            photometric := #cielab  "/ 1976 CIE L*a*b*
+                          ] ifFalse:[
+                            photometric := nil
+                          ]
+                        ]
                       ]
                     ]
                   ]
                 ]
               ]
-            ]
-          ]
+            ].
+
+    "/        'photometric ' print. photometric printNewline.
+
+            ^ self
         ].
+        (tagType == 263) ifTrue:[
+            "/ Treshholding
+            "/      BILEVEL         -> 1
+            "/      HALFTONE        -> 2
+            "/      ERRORDIFFUSE    -> 3
 
-"/        'photometric ' print. photometric printNewline.
+            "threshholding := value."
+
+    "/        'treshholding ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 264) ifTrue:[
+            "CellWidth"
+            "cellWidth:= value."
+
+    "/        'cellWidth ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 265) ifTrue:[
+            "CellLength"
+            "cellLength:= value."
+
+    "/        'cellLength ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 263) ifTrue:[
-        "Treshholding"
-        "threshholding := value."
+            ^ self
+        ].
+        (tagType == 266) ifTrue:[
+            "fillOrder"
+            (value == 1) ifTrue:[
+              fillOrder := #msb
+            ] ifFalse:[
+              (value == 2) ifTrue:[
+                fillOrder := #lsb
+              ] ifFalse:[
+                fillOrder := nil
+              ]
+            ].
+
+    "/        'fillorder ' print. fillOrder printNewline.
 
-"/        'treshholding ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 269) ifTrue:[
+            "documentName - info only"
+
+    "/        'documentName ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 270) ifTrue:[
+            "imageDescription - info only"
+
+    "/        'imageDescription ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 271) ifTrue:[
+            "make - info only"
 
-        ^ self
-    ].
-    (tagType == 264) ifTrue:[
-        "CellWidth"
-        "cellWidth:= value."
+    "/        'make ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 272) ifTrue:[
+            "model - info only"
+
+    "/        'model ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 273) ifTrue:[
+            "stripoffsets"
+            stripOffsets := valueArray.
 
-"/        'cellWidth ' print. value printNewline.
+    "/        'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
+
+            ^ self
+        ].
+        (tagType == 274) ifTrue:[
+            "Orientation"
+
+            orientation :=
+                            #( nil          "/ 1 normal (topLeft)
+                               unsupported  "/ 2 horizontal flip
+                               unsupported  "/ 3 horizontal & vertical flip
+                               vFlip        "/ 4 vertical flip
+                               unsupported  "/ 5 rot 90' counter clock-wise
+                               unsupported  "/ 6 rot 90' clock-wise
+                               unsupported  "/ 7 rot 90' & flip
+                               unsupported  "/ 8 rot 90' ccw & flip
+                             ) at:value ifAbsent:#unsupported.
 
-        ^ self
-    ].
-    (tagType == 265) ifTrue:[
-        "CellLength"
-        "cellLength:= value."
+    "/        'orientation ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 277) ifTrue:[
+            "samplesPerPixel"
+            samplesPerPixel := value.
+
+    "/        'samplesperpixel ' print. samplesPerPixel printNewline.
+
+            ^ self
+        ].
+        (tagType == 278) ifTrue:[
+            "rowsperstrip"
+            rowsPerStrip := value.
+
+    "/        'rowsperstrip ' print. rowsPerStrip printNewline.
 
-"/        'cellLength ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 279) ifTrue:[
+            "stripbytecount"
+            stripByteCounts := valueArray.
+
+    "/        'stripByteCounts Array(' print. 
+    "/        stripByteCounts size print.
+    "/        ')' printNewline.
+
+            ^ self
+        ].
+        (tagType == 280) ifTrue:[
+            "MinSampleValue"
+            "minSampleValue:= value."
+
+    "/        'minSampleValue ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 266) ifTrue:[
-        "fillOrder"
-        (value == 1) ifTrue:[
-          fillOrder := #msb
-        ] ifFalse:[
-          (value == 2) ifTrue:[
-            fillOrder := #lsb
-          ] ifFalse:[
-            fillOrder := nil
-          ]
+            ^ self
+        ].
+        (tagType == 281) ifTrue:[
+            "MaxSampleValue"
+            "maxSampleValue:= value."
+
+    "/        'maxSampleValue ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 282) ifTrue:[
+            "xResolution"
+
+    "/        'xres ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 283) ifTrue:[
+            "yResolution"
+
+    "/        'yres ' print. value printNewline.
+
+            ^ self
         ].
+        (tagType == 284) ifTrue:[
+            "planarconfig"
+            (value == 1) ifTrue:[
+              planarConfiguration := 1
+            ] ifFalse:[
+              (value == 2) ifTrue:[
+                planarConfiguration := 2
+              ] ifFalse:[
+                planarConfiguration := nil
+              ]
+            ].
 
-"/        'fillorder ' print. fillOrder printNewline.
+    "/        'planarconfig ' print. planarConfiguration printNewline.
+
+            ^ self
+        ].
+        (tagType == 285) ifTrue:[
+            "pageName"
+
+    "/        'pageName ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 269) ifTrue:[
-        "documentName - info only"
+            ^ self
+        ].
+        (tagType == 286) ifTrue:[
+            "xPosition"
+
+    "/        'xPos ' print. value printNewline.
 
-"/        'documentName ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 287) ifTrue:[
+            "yPosition"
+
+    "/        'yPos ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 288) ifTrue:[
+            "freeOffsets"
+
+    "/        'freeOffsets ' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 270) ifTrue:[
-        "imageDescription - info only"
+            ^ self
+        ].
+        (tagType == 289) ifTrue:[
+            "freeByteCounts"
+
+    "/        'freeByteCounts ' print. value printNewline.
 
-"/        'imageDescription ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 290) ifTrue:[
+            "grayResponceUnit"
+
+    "/        'grayResponceUnit' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 271) ifTrue:[
-        "make - info only"
+            ^ self
+        ].
+        (tagType == 291) ifTrue:[
+            "grayResponceCurve"
+
+    "/        'grayResponceCurve' print. value printNewline.
 
-"/        'make ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 292) ifTrue:[
+            "/ group3options
+            "/      2DENCODING      -> 1
+            "/      UNCOMPRESSED    -> 2
+            "/      FILLBITS        -> 4
+
+            group3options := value.
+
+    "/        'group3options ' print. group3options printNewline.
 
-        ^ self
-    ].
-    (tagType == 272) ifTrue:[
-        "model - info only"
+            ^ self
+        ].
+        (tagType == 293) ifTrue:[
+            "/ group4options
+            "/      UNCOMPRESSED    -> 2
 
-"/        'model ' print. value printNewline.
+            "group4options := value."
+
+    "/        'group4options ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 296) ifTrue:[
+            "resolutionunit"
 
-        ^ self
-    ].
-    (tagType == 273) ifTrue:[
-        "stripoffsets"
-        stripOffsets := valueArray.
+    "/        (value == 1) ifTrue:[
+    "/            'res-unit pixel' printNewline
+    "/        ] ifFalse:[
+    "/            (value == 2) ifTrue:[
+    "/                'res-unit inch' printNewline
+    "/            ] ifFalse:[
+    "/                (value == 3) ifTrue:[
+    "/                    'res-unit mm' printNewline
+    "/                ] ifFalse:[
+    "/                    'res-unit invalid' printNewline
+    "/                ]
+    "/            ]
+    "/        ].
 
-"/        'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
+            "resolutionUnit := value."
+            ^ self
+        ].
+        (tagType == 297) ifTrue:[
+            "pageNumber"
+            "pageNumber := value."
 
-        ^ self
+    "/        'pageNumber ' print. value printNewline.
+
+            ^ self
+        ].
     ].
-    (tagType == 274) ifTrue:[
-        "Orientation"
+
+    (tagType < 400) ifTrue:[
+        (tagType == 300) ifTrue:[
+            "colorResponceUnit"
+
+    "/        'colorResponceUnit' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 301) ifTrue:[
+            "colorResponceCurve"
+
+    "/        'colorResponceCurve' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 305) ifTrue:[
+            "software - info only"
+
+    "/        'software' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 306) ifTrue:[
+            "dateTime - info only"
+
+    "/        'dateTime ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 315) ifTrue:[
+            "artist - info only"
 
-        orientation :=
-                        #( nil          "/ 1 normal
-                           unsupported  "/ 2 horizontal flip
-                           unsupported  "/ 3 horizontal & vertical flip
-                           vFlip        "/ 4 vertical flip
-                           unsupported  "/ 5 rot 90' counter clock-wise
-                           unsupported  "/ 6 rot 90' clock-wise
-                           unsupported  "/ 7 rot 90' & flip
-                           unsupported  "/ 8 rot 90' ccw & flip
-                         ) at:value ifAbsent:#unsupported.
+    "/        'artist ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 316) ifTrue:[
+            "host computer - info only"
+
+    "/        'host ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 317) ifTrue:[
+            "predictor"
+            predictor := value.
+
+    "/        'predictor ' print. predictor printNewline.
 
-"/        'orientation ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 318) ifTrue:[
+            "whitePoint"
+
+    "/        'whitePoint ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 319) ifTrue:[
+            "primaryChromatics"
+
+    "/        'primaryChromatics ' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 320) ifTrue:[
+            "colorMap"
 
-        ^ self
-    ].
-    (tagType == 277) ifTrue:[
-        "samplesPerPixel"
-        samplesPerPixel := value.
+    "/        'colorMap (size=' print. valueArray size print. ')' printNewline.
+
+            "
+             the tiff colormap contains 16bit values;
+             our colormap expects 8bit values
+            "
+            n := valueArray size // 3.
 
-"/        'samplesperpixel ' print. samplesPerPixel printNewline.
+            rV := ByteArray uninitializedNew:n.
+            gV := ByteArray uninitializedNew:n.
+            bV := ByteArray uninitializedNew:n.
+            scaleFactor := 255.0 / 16rFFFF.
+            i2 := n+1.
+            i3 := 2*n+1.
+            1 to:n do:[:vi |
+                val := ((valueArray at:vi) * scaleFactor) rounded.
+                rV at:vi put:val.
+                val := ((valueArray at:i2) * scaleFactor) rounded.
+                gV at:vi put:val.
+                val := ((valueArray at:i3) * scaleFactor) rounded.
+                bV at:vi put:val.
+                i2 := i2 + 1.
+                i3 := i3 + 1.
+            ].
+            colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
+            ^ self
+        ].
+        (tagType == 321) ifTrue:[
+            "halftonehints"
+
+    "/        'halftonehints' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 278) ifTrue:[
-        "rowsperstrip"
-        rowsPerStrip := value.
+            ^ self
+        ].
+        (tagType == 322) ifTrue:[
+            "tilewidth"
+
+    "/        'tilewidth' print. value printNewline.
 
-"/        'rowsperstrip ' print. rowsPerStrip printNewline.
+            ^ self
+        ].
+        (tagType == 323) ifTrue:[
+            "tilelength"
+
+    "/        'tilelength' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 324) ifTrue:[
+            "tileoffsets"
 
-        ^ self
-    ].
-    (tagType == 279) ifTrue:[
-        "stripbytecount"
-        stripByteCounts := valueArray.
+    "/        'tileoffsets' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 325) ifTrue:[
+            "tilebytecounts"
+
+    "/        'tilebytecounts' print. value printNewline.
 
-"/        'stripByteCounts Array(' print. 
-"/        stripByteCounts size print.
-"/        ')' printNewline.
+            ^ self
+        ].
+        (tagType == 327) ifTrue:[
+            "cleanfaxdata"
+
+    "/        'tilebytecounts' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 328) ifTrue:[
+            "consecutiveBadFaxLines"
 
-        ^ self
-    ].
-    (tagType == 280) ifTrue:[
-        "MinSampleValue"
-        "minSampleValue:= value."
+    "/        'consecutiveBadFaxLines' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 330) ifTrue:[
+            "subifd"
+
+    "/        'subifd' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 332) ifTrue:[
+            "ink set"
+
+    "/        'ink set' print. value printNewline.
 
-"/        'minSampleValue ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 333) ifTrue:[
+            "ink names"
+
+    "/        'ink names' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 336) ifTrue:[
+            "dot range"
+
+    "/        'dot range' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 337) ifTrue:[
+            "target printer"
 
-        ^ self
-    ].
-    (tagType == 281) ifTrue:[
-        "MaxSampleValue"
-        "maxSampleValue:= value."
+    "/        'target printer' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 338) ifTrue:[
+            "extrasamples"
+
+    "/        'extrasamples' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 339) ifTrue:[
+            "sample format"
+
+    "/        'sample format' print. value printNewline.
 
-"/        'maxSampleValue ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 340) ifTrue:[
+            "min sample value"
+
+    "/        'min sample value' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 282) ifTrue:[
-        "xResolution"
+            ^ self
+        ].
+        (tagType == 341) ifTrue:[
+            "max sample value"
+
+    "/        'max sample value' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 347) ifTrue:[
+            "jpegtables"
 
-"/        'xres ' print. value printNewline.
+    "/        'jpegtables' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 283) ifTrue:[
-        "yResolution"
-
-"/        'yres ' print. value printNewline.
-
-        ^ self
+            ^ self
+        ].
     ].
-    (tagType == 284) ifTrue:[
-        "planarconfig"
-        (value == 1) ifTrue:[
-          planarConfiguration := 1
-        ] ifFalse:[
-          (value == 2) ifTrue:[
-            planarConfiguration := 2
-          ] ifFalse:[
-            planarConfiguration := nil
-          ]
+
+    (tagType < 600) ifTrue:[
+        "/ obsolete JPEG tags
+        (tagType == 512) ifTrue:[
+            "jpeg proc"
+
+    "/        'jpeg proc' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 513) ifTrue:[
+            "jpeg proc"
+
+    "/        'jpeg proc' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 514) ifTrue:[
+            "jpeg ifByteCount"
+
+    "/        'jpeg ifByteCount' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 515) ifTrue:[
+            "jpeg restartInterval"
+
+    "/        'jpeg restartInterval' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 517) ifTrue:[
+            "jpeg glossLessPredictors"
+
+    "/        'jpeg glossLessPredictors' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 518) ifTrue:[
+            "jpeg pointTransform"
+
+    "/        'jpeg pointTransform' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 519) ifTrue:[
+            "jpeg qTables"
+
+    "/        'jpeg qTables' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 520) ifTrue:[
+            "jpeg dcTables"
+
+    "/        'jpeg dcTables' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 521) ifTrue:[
+            "jpeg acTables"
+
+    "/        'jpeg acTables' print. value printNewline.
+
+            ^ self
         ].
 
-"/        'planarconfig ' print. planarConfiguration printNewline.
-
-        ^ self
-    ].
-    (tagType == 285) ifTrue:[
-        "pageName"
-
-"/        'pageName ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 286) ifTrue:[
-        "xPosition"
 
-"/        'xPos ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 287) ifTrue:[
-        "yPosition"
+        (tagType == 529) ifTrue:[
+            "ycbr coeff"
 
-"/        'yPos ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 288) ifTrue:[
-        "freeOffsets"
-
-"/        'freeOffsets ' print. value printNewline.
+    "/        'ycbr coeff' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 289) ifTrue:[
-        "freeByteCounts"
-
-"/        'freeByteCounts ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 290) ifTrue:[
-        "grayResponceUnit"
-
-"/        'grayResponceUnit' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 530) ifTrue:[
+            "ycbr subsampling"
 
-        ^ self
-    ].
-    (tagType == 291) ifTrue:[
-        "grayResponceCurve"
-
-"/        'grayResponceCurve' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 292) ifTrue:[
-        "group3options"
-        group3options := value.
-
-"/        'group3options ' print. group3options printNewline.
-
-        ^ self
-    ].
-    (tagType == 293) ifTrue:[
-        "group4options"
-        "group4options := value."
-
-"/        'group4options ' print. value printNewline.
+    "/        'ycbr subsampling' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 296) ifTrue:[
-        "resolutionunit"
+            ^ self
+        ].
+        (tagType == 531) ifTrue:[
+            "ycbr positioning"
 
-"/        (value == 1) ifTrue:[
-"/            'res-unit pixel' printNewline
-"/        ] ifFalse:[
-"/            (value == 2) ifTrue:[
-"/                'res-unit inch' printNewline
-"/            ] ifFalse:[
-"/                (value == 3) ifTrue:[
-"/                    'res-unit mm' printNewline
-"/                ] ifFalse:[
-"/                    'res-unit invalid' printNewline
-"/                ]
-"/            ]
-"/        ].
-
-        "resolutionUnit := value."
-        ^ self
-    ].
-    (tagType == 297) ifTrue:[
-        "pageNumber"
-        "pageNumber := value."
-
-"/        'pageNumber ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 300) ifTrue:[
-        "colorResponceUnit"
-
-"/        'colorResponceUnit' print. value printNewline.
+    "/        'ycbr positioning' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 301) ifTrue:[
-        "colorResponceCurve"
-
-"/        'colorResponceCurve' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 305) ifTrue:[
-        "software - info only"
-
-"/        'software' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 532) ifTrue:[
+            "referenceBlackWhite"
 
-        ^ self
-    ].
-    (tagType == 306) ifTrue:[
-        "dateTime - info only"
-
-"/        'dateTime ' print. value printNewline.
+    "/        'ycbr positioning' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 315) ifTrue:[
-        "artist - info only"
-
-"/        'artist ' print. value printNewline.
-
-        ^ self
-    ].
-    (tagType == 316) ifTrue:[
-        "host computer - info only"
-
-"/        'host ' print. value printNewline.
-
-        ^ self
+            ^ self
+        ].
     ].
-    (tagType == 317) ifTrue:[
-        "predictor"
-        predictor := value.
+
+    (tagType > 32000) ifTrue:[
 
-"/        'predictor ' print. predictor printNewline.
+        "/ Private Island graphics tags
+        (tagType == 32953) ifTrue:[
+            "ref points"
 
-        ^ self
-    ].
-    (tagType == 318) ifTrue:[
-        "whitePoint"
+    "/        'ref points' print. value printNewline.
 
-"/        'whitePoint ' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 32954) ifTrue:[
+            "regionTagPoint"
+
+    "/        'regionTagPoint' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 319) ifTrue:[
-        "primaryChromatics"
+            ^ self
+        ].
+        (tagType == 32955) ifTrue:[
+            "regionWarpCorners"
 
-"/        'primaryChromatics ' print. value printNewline.
+    "/        'regionWarpCorners' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 320) ifTrue:[
-        "colorMap"
+            ^ self
+        ].
+        (tagType == 32956) ifTrue:[
+            "regionAffine"
 
-"/        'colorMap (size=' print. valueArray size print. ')' printNewline.
+    "/        'regionAffine' print. value printNewline.
 
-        "
-         the tiff colormap contains 16bit values;
-         our colormap expects 8bit values
-        "
-        n := valueArray size // 3.
+            ^ self
+        ].
+
+
+        "/ Private SGI tags
 
-        rV := ByteArray uninitializedNew:n.
-        gV := ByteArray uninitializedNew:n.
-        bV := ByteArray uninitializedNew:n.
-        scaleFactor := 255.0 / 16rFFFF.
-        i2 := n+1.
-        i3 := 2*n+1.
-        1 to:n do:[:vi |
-            val := ((valueArray at:vi) * scaleFactor) rounded.
-            rV at:vi put:val.
-            val := ((valueArray at:i2) * scaleFactor) rounded.
-            gV at:vi put:val.
-            val := ((valueArray at:i3) * scaleFactor) rounded.
-            bV at:vi put:val.
-            i2 := i2 + 1.
-            i3 := i3 + 1.
+        (tagType == 32995) ifTrue:[
+            "matteing"
+
+    "/        'matteing' print. value printNewline.
+
+            ^ self
+        ].
+        (tagType == 32996) ifTrue:[
+            "datatype"
+
+    "/        'datatype' print. value printNewline.
+
+            ^ self
         ].
-        colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
-        ^ self
-    ].
-    (tagType == 332) ifTrue:[
-        "ink set"
+        (tagType == 32997) ifTrue:[
+            "imagedepth"
+
+    "/        'imagedepth' print. value printNewline.
 
-"/        'ink set' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 32998) ifTrue:[
+            "tiledepth"
 
-        ^ self
-    ].
-    (tagType == 333) ifTrue:[
-        "ink names"
+    "/        'tiledepth' print. value printNewline.
 
-"/        'ink names' print. value printNewline.
+            ^ self
+        ].
 
-        ^ self
-    ].
-    (tagType == 336) ifTrue:[
-        "dot range"
+        "/ Private Pixar tags
 
-"/        'dot range' print. value printNewline.
+        (tagType == 33300) ifTrue:[
+            "image full width"
+
+    "/        'image full width' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 337) ifTrue:[
-        "target printer"
+            ^ self
+        ].
+        (tagType == 33301) ifTrue:[
+            "image full length"
 
-"/        'target printer' print. value printNewline.
+    "/        'image full length' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 339) ifTrue:[
-        "sample format"
+            ^ self
+        ].
+
+        "/ Private Eastman Kodak tags
 
-"/        'sample format' print. value printNewline.
+        (tagType == 33405) ifTrue:[
+            "write serial number"
+
+    "/        'write serial number' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 340) ifTrue:[
-        "min sample value"
+            ^ self
+        ].
+
+        "/ unknown
 
-"/        'min sample value' print. value printNewline.
+        (tagType == 33432) ifTrue:[
+            "copyright"
+
+    "/        'copyright' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 341) ifTrue:[
-        "max sample value"
+            ^ self
+        ].
 
-"/        'max sample value' print. value printNewline.
+        "/ Private Texas instruments
 
-        ^ self
-    ].
-    (tagType == 512) ifTrue:[
-        "jpeg proc"
+        (tagType == 34232) ifTrue:[
+            "sequence frame count"
 
-"/        'jpeg proc' print. value printNewline.
+    "/        'sequence frame count' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 513) ifTrue:[
-        "jpeg proc"
+            ^ self
+        ].
 
-"/        'jpeg proc' print. value printNewline.
+        "/ Private Pixel magic
+
+        (tagType == 34232) ifTrue:[
+            "jbig options"
 
-        ^ self
-    ].
-    (tagType == 32995) ifTrue:[
-        "matteing"
+    "/        'jbig options' print. value printNewline.
+
+            ^ self
+        ].
 
-"/        'matteing' print. value printNewline.
+        "/ More Private SGI
+
+        (tagType == 34908) ifTrue:[
+            "fax recv params"
 
-        ^ self
-    ].
-    (tagType == 32996) ifTrue:[
-        "datatype"
+    "/        'fax recv params' print. value printNewline.
 
-"/        'datatype' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 34909) ifTrue:[
+            "fax subaddress"
+
+    "/        'fax subaddress' print. value printNewline.
 
-        ^ self
-    ].
-    (tagType == 32997) ifTrue:[
-        "imagedepth"
-
-"/        'imagedepth' print. value printNewline.
+            ^ self
+        ].
+        (tagType == 34910) ifTrue:[
+            "fax recv time"
 
-        ^ self
-    ].
-    (tagType == 32998) ifTrue:[
-        "tiledepth"
+    "/        'fax recv time' print. value printNewline.
 
-"/        'tiledepth' print. value printNewline.
-
-        ^ self
+            ^ self
+        ].
     ].
 
 "/
@@ -693,10 +995,10 @@
 "/
     'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
 
-    "Modified: 31.1.1997 / 10:50:38 / cg"
+    "Modified: 11.4.1997 / 00:17:13 / cg"
 ! !
 
-!TIFFReader methodsFor:'private - reading'!
+!TIFFReader methodsFor:'private - data reading'!
 
 readCCITT3RLETiffImageData
      'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR.
@@ -777,48 +1079,25 @@
     "Modified: 10.1.1997 / 19:10:59 / cg"
 !
 
-readChars:n
-    "read n characters and return them in a string"
-
-    |oldPos offset string|
-
-    n == 0 ifTrue:[^ ''].
+readDCSTiffImageData
+    'TIFFReader [warning]: dcs compression not implemented' errorPrintCR
 
-    string := String new:(n - 1).
-    (n <= 4) ifTrue:[
-        inStream nextBytes:(n - 1) into:string
-    ] ifFalse:[
-        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
-        oldPos := inStream position.
-        inStream position:(offset + 1).
-        inStream nextBytes:(n - 1) into:string.
-        inStream position:oldPos
-    ].
-    ^ string
-
-    "Modified: 5.9.1996 / 12:21:08 / cg"
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:54 / cg"
 !
 
-readFracts:nFracts
-    "read nFracts fractions (2 32bit words) and return them in an array"
-
-    |oldPos offset values numerator denominator msb
-     n "{ Class: SmallInteger }" |
-
-    n := nFracts.
+readDeflateTiffImageData
+    'TIFFReader [warning]: deflate compression not implemented' errorPrintCR
 
-    msb := byteOrder ~~ #lsb.
-    values := Array basicNew:n.
-    offset := inStream nextLongMSB:msb.
-    oldPos := inStream position.
-    inStream position:(offset + 1).
-    1 to:n do:[:index |
-	numerator := inStream nextLongMSB:msb.
-	denominator := inStream nextLongMSB:msb.
-	values at:index put:(Fraction numerator:numerator denominator:denominator)
-    ].
-    inStream position:oldPos.
-    ^ values
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:45 / cg"
+!
+
+readJBIGTiffImageData
+    'TIFFReader [warning]: jbig compression not implemented' errorPrintCR
+
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:31:00 / cg"
 !
 
 readJPEGTiffImageData
@@ -908,30 +1187,6 @@
     "Modified: 10.1.1997 / 18:13:21 / cg"
 !
 
-readLongs:nLongs
-    "read nLongs long numbers (32bit) and return them in an array"
-
-    |oldPos offset values msb 
-     n "{ Class: SmallInteger }" |
-
-    n := nLongs.
-
-    msb := byteOrder ~~ #lsb.
-    values := Array basicNew:n.
-    (n == 1) ifTrue:[
-	values at:1 put:(inStream nextLongMSB:msb).
-    ] ifFalse:[
-	offset := inStream nextLongMSB:msb.
-	oldPos := inStream position.
-	inStream position:(offset + 1).
-	1 to:n do:[:index |
-	    values at:index put:(inStream nextLongMSB:msb)
-	].
-	inStream position:oldPos
-    ].
-    ^ values
-!
-
 readNeXTJPEGTiffImageData
     'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR
 
@@ -953,33 +1208,88 @@
     "Modified: 10.1.1997 / 18:10:57 / cg"
 !
 
-readShorts:nShorts
-    "read nShorts short numbers (16bit) and return them in an array"
+readPixarFilmTiffImageData
+    'TIFFReader [warning]: pixar film compression not implemented' errorPrintCR
 
-    |oldPos offset values msb val2
-     n "{ Class: SmallInteger }" |
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:33 / cg"
+!
+
+readPixarLogTiffImageData
+    'TIFFReader [warning]: pixar log compression not implemented' errorPrintCR
 
-    n := nShorts.
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:39 / cg"
+!
 
-    msb := (byteOrder ~~ #lsb).
-    values := Array basicNew:n.
-    (n <= 2) ifTrue:[
-	values at:1 put:(inStream nextUnsignedShortMSB:msb).
-	val2 := inStream nextUnsignedShortMSB:msb.
+readThunderScanTiffImageData
+    'TIFFReader [warning]: thunderScan compression not implemented' errorPrintCR
+
+    "Modified: 10.1.1997 / 18:11:04 / cg"
+    "Created: 11.4.1997 / 00:30:23 / cg"
+!
 
-	(n == 2) ifTrue:[
-	    values at:2 put:val2
-	]
-    ] ifFalse:[
-	offset := inStream nextLongMSB:msb.
-	oldPos := inStream position.
-	inStream position:(offset + 1).
-	1 to:n do:[:index |
-	    values at:index put:(inStream nextUnsignedShortMSB:msb)
-	].
-	inStream position:oldPos
+readTiffImageData
+    (compression == 1) ifTrue:[
+        ^ self readUncompressedTiffImageData.
+    ].
+    (compression == 2) ifTrue:[
+        ^ self readCCITT3RLETiffImageData.
+    ].
+    (compression == 3) ifTrue:[
+        ^ self readCCITTGroup3TiffImageData.
+    ]. 
+    (compression == 4) ifTrue:[
+        ^ self readCCITTGroup4TiffImageData.
+    ]. 
+    (compression == 5) ifTrue:[
+        ^ self readLZWTiffImageData.
+    ].
+    (compression == 6) ifTrue:[
+        ^ self readJPEGTiffImageData.
+    ].
+    (compression == 7) ifTrue:[
+        ^ self readNewJPEGTiffImageData.
+    ].
+
+    (compression == 32766) ifTrue:[
+        ^ self readNeXTRLE2TiffImageData.
+    ].
+    (compression == 32771) ifTrue:[
+        ^ self readCCITTRLEWTiffImageData.
     ].
-    ^ values
+    (compression == 32773) ifTrue:[
+        ^ self readPackbitsTiffImageData.
+    ].
+    (compression == 32809) ifTrue:[
+        ^ self readThunderScanTiffImageData.
+    ].
+    (compression == 32908) ifTrue:[
+        ^ self readPixarFilmTiffImageData.
+    ].
+    (compression == 32909) ifTrue:[
+        ^ self readPixarLogTiffImageData.
+    ].
+    (compression == 32946) ifTrue:[
+        ^ self readDeflateTiffImageData.
+    ].
+    (compression == 32947) ifTrue:[
+        ^ self readDCSTiffImageData.
+    ].
+    (compression == 32865) ifTrue:[
+        ^ self readNeXTJPEGTiffImageData.
+    ].
+    (compression == 34661) ifTrue:[
+        ^ self readJBIGTiffImageData.
+    ].
+
+    'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
+    ' not known' errorPrintCR.
+
+    ^ nil.
+
+    "Created: 11.4.1997 / 00:19:44 / cg"
+    "Modified: 11.4.1997 / 00:29:54 / cg"
 !
 
 readUncompressedTiffImageData
@@ -1056,6 +1366,105 @@
     "Modified: 10.1.1997 / 18:10:46 / cg"
 ! !
 
+!TIFFReader methodsFor:'private - reading'!
+
+readChars:n
+    "read n characters and return them in a string"
+
+    |oldPos offset string|
+
+    n == 0 ifTrue:[^ ''].
+
+    string := String new:(n - 1).
+    (n <= 4) ifTrue:[
+        inStream nextBytes:(n - 1) into:string
+    ] ifFalse:[
+        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
+        oldPos := inStream position.
+        inStream position:(offset + 1).
+        inStream nextBytes:(n - 1) into:string.
+        inStream position:oldPos
+    ].
+    ^ string
+
+    "Modified: 5.9.1996 / 12:21:08 / cg"
+!
+
+readFracts:nFracts
+    "read nFracts fractions (2 32bit words) and return them in an array"
+
+    |oldPos offset values numerator denominator msb
+     n "{ Class: SmallInteger }" |
+
+    n := nFracts.
+
+    msb := byteOrder ~~ #lsb.
+    values := Array basicNew:n.
+    offset := inStream nextLongMSB:msb.
+    oldPos := inStream position.
+    inStream position:(offset + 1).
+    1 to:n do:[:index |
+	numerator := inStream nextLongMSB:msb.
+	denominator := inStream nextLongMSB:msb.
+	values at:index put:(Fraction numerator:numerator denominator:denominator)
+    ].
+    inStream position:oldPos.
+    ^ values
+!
+
+readLongs:nLongs
+    "read nLongs long numbers (32bit) and return them in an array"
+
+    |oldPos offset values msb 
+     n "{ Class: SmallInteger }" |
+
+    n := nLongs.
+
+    msb := byteOrder ~~ #lsb.
+    values := Array basicNew:n.
+    (n == 1) ifTrue:[
+	values at:1 put:(inStream nextLongMSB:msb).
+    ] ifFalse:[
+	offset := inStream nextLongMSB:msb.
+	oldPos := inStream position.
+	inStream position:(offset + 1).
+	1 to:n do:[:index |
+	    values at:index put:(inStream nextLongMSB:msb)
+	].
+	inStream position:oldPos
+    ].
+    ^ values
+!
+
+readShorts:nShorts
+    "read nShorts short numbers (16bit) and return them in an array"
+
+    |oldPos offset values msb val2
+     n "{ Class: SmallInteger }" |
+
+    n := nShorts.
+
+    msb := (byteOrder ~~ #lsb).
+    values := Array basicNew:n.
+    (n <= 2) ifTrue:[
+	values at:1 put:(inStream nextUnsignedShortMSB:msb).
+	val2 := inStream nextUnsignedShortMSB:msb.
+
+	(n == 2) ifTrue:[
+	    values at:2 put:val2
+	]
+    ] ifFalse:[
+	offset := inStream nextLongMSB:msb.
+	oldPos := inStream position.
+	inStream position:(offset + 1).
+	1 to:n do:[:index |
+	    values at:index put:(inStream nextUnsignedShortMSB:msb)
+	].
+	inStream position:oldPos
+    ].
+    ^ values
+! !
+
 !TIFFReader methodsFor:'private - writing'!
 
 writeBitsPerSample
@@ -1445,7 +1854,7 @@
      tagType      "{ Class: SmallInteger }"
      numberType   "{ Class: SmallInteger }"
      length       "{ Class: SmallInteger }"
-     result offset ok msb
+     result offset msb
      bitsPerPixel bytesPerRow offset1 offset2 tmp|
 
     inStream := aStream.
@@ -1509,25 +1918,24 @@
     ].
 
     "check for required tags"
-    ok := true.
     width isNil ifTrue:[
         'TIFFReader [warning]: missing width tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     height isNil ifTrue:[
         'TIFFReader [warning]: missing length tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     photometric isNil ifTrue:[
         'TIFFReader [warning]: missing photometric tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     stripOffsets isNil ifTrue:[
         'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR.
-        ok := false
+        ^ nil
     ].
 
     stripByteCounts isNil ifTrue:[
@@ -1538,10 +1946,6 @@
 
     stripByteCounts isNil ifTrue:[
         'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR.
-        ok := false
-    ].
-
-    ok ifFalse:[
         ^ nil
     ].
 
@@ -1555,77 +1959,35 @@
         rowsPerStrip := height
     ].
 
-    ok := false.
-    (compression == 1) ifTrue:[
-        result := self readUncompressedTiffImageData.
-        ok := true
-    ].
-    (compression == 2) ifTrue:[
-        result := self readCCITT3RLETiffImageData.
-        ok := true
-    ].
-    (compression == 3) ifTrue:[
-        result := self readCCITTGroup3TiffImageData.
-        ok := true
-    ]. 
-    (compression == 4) ifTrue:[
-        result := self readCCITTGroup4TiffImageData.
-        ok := true
-    ]. 
-    (compression == 5) ifTrue:[
-        result := self readLZWTiffImageData.
-        ok := true
-    ].
-    (compression == 6) ifTrue:[
-        result := self readJPEGTiffImageData.
-        ok := true
-    ].
-    (compression == 32766) ifTrue:[
-        result := self readNeXTRLE2TiffImageData.
-        ok := true
-    ].
-    (compression == 32771) ifTrue:[
-        result := self readCCITTRLEWTiffImageData.
-        ok := true
-    ].
-    (compression == 32773) ifTrue:[
-        result := self readPackbitsTiffImageData.
-        ok := true
-    ].
-    (compression == 32865) ifTrue:[
-        result := self readNeXTJPEGTiffImageData.
-        ok := true
-    ].
-    ok ifFalse:[
-        'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
-        ' not known' errorPrintCR
-    ].
+    result := self readTiffImageData.
+    result notNil ifTrue:[
+
+        orientation == #vFlip ifTrue:[
+            "/ reverse rows to top-to bottom
 
-    orientation == #vFlip ifTrue:[
-        "/ reverse rows to top-to bottom
-
-        bytesPerRow := self bytesPerRow.
-        tmp := ByteArray new:bytesPerRow.
-        offset1 := 1.
-        offset2 := (height-1)*bytesPerRow + 1.
-        0 to:(height-1//2) do:[:row |
-            tmp replaceFrom:1 to:bytesPerRow
-                with:data startingAt:offset1.
-            data replaceFrom:offset1 to:offset1+bytesPerRow-1
-                 with:data startingAt:offset2.
-            data replaceFrom:offset2 to:offset2+bytesPerRow-1
-                 with:tmp startingAt:1.
-            offset1 := offset1 + bytesPerRow.
-            offset2 := offset2 - bytesPerRow.
+            bytesPerRow := self bytesPerRow.
+            tmp := ByteArray new:bytesPerRow.
+            offset1 := 1.
+            offset2 := (height-1)*bytesPerRow + 1.
+            0 to:(height-1//2) do:[:row |
+                tmp replaceFrom:1 to:bytesPerRow
+                    with:data startingAt:offset1.
+                data replaceFrom:offset1 to:offset1+bytesPerRow-1
+                     with:data startingAt:offset2.
+                data replaceFrom:offset2 to:offset2+bytesPerRow-1
+                     with:tmp startingAt:1.
+                offset1 := offset1 + bytesPerRow.
+                offset2 := offset2 - bytesPerRow.
+            ].
         ].
-    ].
-    orientation == #unsupported ifTrue:[
-        'TIFFReader [warning]: unsupported orientation' errorPrintCR
+        orientation == #unsupported ifTrue:[
+            'TIFFReader [warning]: unsupported orientation' errorPrintCR
+        ].
     ].
 
     ^ result
 
-    "Modified: 31.1.1997 / 10:51:27 / cg"
+    "Modified: 11.4.1997 / 00:21:58 / cg"
 ! !
 
 !TIFFReader methodsFor:'writing to file'!
@@ -1730,6 +2092,6 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.50 1997-02-27 11:50:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.51 1997-04-10 22:42:03 cg Exp $'
 ! !
 TIFFReader initialize!