fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
authorClaus Gittinger <cg@exept.de>
Sun, 04 Feb 1996 16:35:54 +0100
changeset 159 327da5085900
parent 158 16f2237474fe
child 160 ee4d64b12c94
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
TIFFRdr.st
TIFFReader.st
--- a/TIFFRdr.st	Sat Jan 27 19:36:37 1996 +0100
+++ b/TIFFRdr.st	Sun Feb 04 16:35:54 1996 +0100
@@ -12,9 +12,9 @@
 
 ImageReader subclass:#TIFFReader
 	 instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip
-                fillOrder compression group3options predictor stripByteCounts
-                currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
-                colorMapPos'
+		fillOrder compression group3options predictor stripByteCounts
+		currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
+		colorMapPos'
 	 classVariableNames:''
 	 poolDictionaries:''
 	 category:'Graphics-Images support'
@@ -43,12 +43,13 @@
 
     Only single image files are supported.
     Not all formats are implemented, and of those that are, not all are tested.
-    It should work with most rgb, mono and 2-plane greyscale
+    It should read with most rgb, mono and 2-plane greyscale
     images, since this is what I have as test material on the NeXT.
     It supports reading of uncompressed, LZW and G3 compressed 
     images; JPEG and packbits are currently not implemented.
 
     Only writing of uncompressed images is currently implemented.
+    It should write (at least) mono, 8-bit palette and 24 bit rgb formats.
     More formats will come ...
 
     TODO: since I dont want to spend all of my life adding more formats here and
@@ -1569,11 +1570,9 @@
     currentOffset := 0.
 
     (byteOrder == #msb) ifTrue:[
-	outStream nextPut:$M.
-	outStream nextPut:$M.
+	outStream nextPut:$M. outStream nextPut:$M.
     ] ifFalse:[
-	outStream nextPut:$I.
-	outStream nextPut:$I.
+	outStream nextPut:$I. outStream nextPut:$I.
     ].
     currentOffset := currentOffset + 2.
 
@@ -1607,9 +1606,9 @@
     "output tag data"
 
     photometric == #palette ifTrue:[
-	self writeShort:10.  "10 tags"
+	self writeShort:11.  "11 tags"
     ] ifFalse:[
-	self writeShort:9.   "9 tags"
+	self writeShort:10.  "10 tags"
     ].
     self writeTag:256.               "image width"
     self writeTag:257.               "image height"
@@ -1617,6 +1616,7 @@
     self writeTag:259.               "compression"
     self writeTag:262.               "photometric"
     self writeTag:273.               "strip offsets"
+    self writeTag:277.               "samplesPerPixel"
     self writeTag:278.               "rowsPerStrip"
     self writeTag:279.               "strip byte counts"
     self writeTag:284.               "planarconfig"
@@ -1630,6 +1630,6 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.27 1995-12-07 11:38:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.28 1996-02-04 15:35:54 cg Exp $'
 ! !
 TIFFReader initialize!
--- a/TIFFReader.st	Sat Jan 27 19:36:37 1996 +0100
+++ b/TIFFReader.st	Sun Feb 04 16:35:54 1996 +0100
@@ -12,9 +12,9 @@
 
 ImageReader subclass:#TIFFReader
 	 instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip
-                fillOrder compression group3options predictor stripByteCounts
-                currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
-                colorMapPos'
+		fillOrder compression group3options predictor stripByteCounts
+		currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
+		colorMapPos'
 	 classVariableNames:''
 	 poolDictionaries:''
 	 category:'Graphics-Images support'
@@ -43,12 +43,13 @@
 
     Only single image files are supported.
     Not all formats are implemented, and of those that are, not all are tested.
-    It should work with most rgb, mono and 2-plane greyscale
+    It should read with most rgb, mono and 2-plane greyscale
     images, since this is what I have as test material on the NeXT.
     It supports reading of uncompressed, LZW and G3 compressed 
     images; JPEG and packbits are currently not implemented.
 
     Only writing of uncompressed images is currently implemented.
+    It should write (at least) mono, 8-bit palette and 24 bit rgb formats.
     More formats will come ...
 
     TODO: since I dont want to spend all of my life adding more formats here and
@@ -1569,11 +1570,9 @@
     currentOffset := 0.
 
     (byteOrder == #msb) ifTrue:[
-	outStream nextPut:$M.
-	outStream nextPut:$M.
+	outStream nextPut:$M. outStream nextPut:$M.
     ] ifFalse:[
-	outStream nextPut:$I.
-	outStream nextPut:$I.
+	outStream nextPut:$I. outStream nextPut:$I.
     ].
     currentOffset := currentOffset + 2.
 
@@ -1607,9 +1606,9 @@
     "output tag data"
 
     photometric == #palette ifTrue:[
-	self writeShort:10.  "10 tags"
+	self writeShort:11.  "11 tags"
     ] ifFalse:[
-	self writeShort:9.   "9 tags"
+	self writeShort:10.  "10 tags"
     ].
     self writeTag:256.               "image width"
     self writeTag:257.               "image height"
@@ -1617,6 +1616,7 @@
     self writeTag:259.               "compression"
     self writeTag:262.               "photometric"
     self writeTag:273.               "strip offsets"
+    self writeTag:277.               "samplesPerPixel"
     self writeTag:278.               "rowsPerStrip"
     self writeTag:279.               "strip byte counts"
     self writeTag:284.               "planarconfig"
@@ -1630,6 +1630,6 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.27 1995-12-07 11:38:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.28 1996-02-04 15:35:54 cg Exp $'
 ! !
 TIFFReader initialize!