author | Claus Gittinger <cg@exept.de> |
Sun, 02 Nov 1997 19:54:27 +0100 | |
changeset 736 | d9f874e6b1e4 |
parent 713 | 548898fdd1dc |
child 806 | fc45835a5967 |
permissions | -rw-r--r-- |
713 | 1 |
'From Smalltalk/X, Version:3.2.1 on 17-oct-1997 at 9:13:03 pm' ! |
2 | 2 |
|
3 |
ImageReader subclass:#PBMReader |
|
200 | 4 |
instanceVariableNames:'' |
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
259 | 7 |
category:'Graphics-Images-Support' |
2 | 8 |
! |
9 |
||
21 | 10 |
!PBMReader class methodsFor:'documentation'! |
11 |
||
12 |
documentation |
|
13 |
" |
|
32 | 14 |
this class provides methods for loading and saving Portable BitMap-file |
15 |
images (Jef Poskanzers portable bitmap package). |
|
200 | 16 |
|
46 | 17 |
Reading is supported for 1bit (pbm), greyscale (pgm) and 24bit (ppm) formats. |
507 | 18 |
(i.e. P1, P3, P4, P5 and P6 formats) |
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
19 |
Writing is (currently) only supported for the binary formats; |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
20 |
i.e. 1-bit images as (pbm P4), 8-bit gray as (pgm P5) and 24-bit images as (pnm P6). |
46 | 21 |
|
22 |
Q: should we bring this one to perfection and base all others on |
|
23 |
pipe-readers to the various pbmplus converters ? |
|
200 | 24 |
|
25 |
[See also:] |
|
234 | 26 |
Image Form Icon |
200 | 27 |
BlitImageReader FaceReader GIFReader JPEGReader PCXReader |
210 | 28 |
ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader |
209 | 29 |
XBMReader XPMReader XWDReader |
21 | 30 |
" |
31 |
! ! |
|
2 | 32 |
|
713 | 33 |
!PBMReader class methodsFor:'testing'! |
34 |
||
35 |
canRepresent:anImage |
|
36 |
"return true, if anImage can be represented in my file format. |
|
37 |
Currently, only 1bit B&W, 8bit-grey and 24bit RGB images are supported." |
|
38 |
||
39 |
|depth photometric| |
|
40 |
||
41 |
anImage photometric == #rgb ifTrue:[ |
|
42 |
^ depth==24 |
|
43 |
]. |
|
44 |
(depth := anImage depth) == 1 ifTrue:[^ true]. |
|
45 |
depth == 8 ifTrue:[ |
|
46 |
photometric := anImage photometric. |
|
47 |
^ (photometric == #blackIs0) or:[photometric == #whiteIs0] |
|
48 |
]. |
|
49 |
^ false |
|
50 |
||
51 |
"Modified: 17.10.1997 / 20:20:52 / cg" |
|
52 |
! ! |
|
53 |
||
200 | 54 |
!PBMReader methodsFor:'reading from file'! |
55 |
||
56 |
readDepth8PGMStream:aStream |
|
506 | 57 |
"import portable gray map (PGM, P5 format); P5 is already read" |
200 | 58 |
|
59 |
|maxval| |
|
60 |
||
61 |
self skipPBMJunkOn:aStream. |
|
62 |
width := Integer readFrom:aStream. |
|
63 |
width > 0 ifFalse:[ |
|
506 | 64 |
'PBMREADER: Invalid width' errorPrintNL. |
65 |
^ nil |
|
200 | 66 |
]. |
67 |
self skipPBMJunkOn:aStream. |
|
68 |
height := Integer readFrom:aStream. |
|
69 |
height > 0 ifFalse:[ |
|
506 | 70 |
'PBMREADER: Invalid height' errorPrintNL. |
71 |
^ nil |
|
200 | 72 |
]. |
73 |
self skipPBMJunkOn:aStream. |
|
74 |
maxval := Integer readFrom:aStream. |
|
75 |
maxval >= 256 ifTrue:[ |
|
506 | 76 |
'PBMREADER: Invalid format' errorPrintNL. |
77 |
^ nil |
|
200 | 78 |
]. |
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
79 |
aStream nextLine "skipThrough: Character cr". |
523 | 80 |
|
81 |
"/ the rest is the binary image data ... |
|
200 | 82 |
aStream binary. |
523 | 83 |
data := ByteArray uninitializedNew:(width*height). |
84 |
aStream nextBytes:(data size) into:data. |
|
200 | 85 |
|
86 |
photometric := #blackIs0. |
|
87 |
samplesPerPixel := 1. |
|
88 |
bitsPerSample := #(8). |
|
506 | 89 |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
90 |
"Modified: 14.10.1997 / 19:44:05 / cg" |
200 | 91 |
! ! |
92 |
||
2 | 93 |
!PBMReader methodsFor:'writing to file'! |
94 |
||
95 |
save:image onFile:aFileName |
|
96 |
"save image as PBM/PGM/PNM file on aFileName" |
|
97 |
||
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
98 |
|bitsPerPixel| |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
99 |
|
2 | 100 |
outStream := FileStream newFileNamed:aFileName. |
101 |
outStream isNil ifTrue:[ |
|
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
102 |
'PBMReader [error]: file create error' errorPrintNL. |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
103 |
^ Image fileCreationErrorSignal |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
104 |
raiseWith:image |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
105 |
errorString:('file creation error: ' , aFileName asString). |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
106 |
]. |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
107 |
|
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
108 |
image mask notNil ifTrue:[ |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
109 |
Image informationLostQuerySignal |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
110 |
raiseWith:image |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
111 |
errorString:('PBM format does not support an imageMask'). |
2 | 112 |
]. |
113 |
||
114 |
width := image width. |
|
115 |
height := image height. |
|
116 |
photometric := image photometric. |
|
117 |
samplesPerPixel := image samplesPerPixel. |
|
118 |
bitsPerSample := image bitsPerSample. |
|
119 |
colorMap := image colorMap. |
|
46 | 120 |
data := image bits. |
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
121 |
bitsPerPixel := image bitsPerPixel. |
2 | 122 |
|
123 |
photometric == #rgb ifTrue:[ |
|
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
124 |
^ self writePNMFileOn:outStream |
2 | 125 |
]. |
126 |
samplesPerPixel == 1 ifTrue:[ |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
127 |
(bitsPerPixel == 1) ifTrue:[ |
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
128 |
^ self writePBMFileOn:outStream |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
129 |
]. |
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
130 |
(bitsPerPixel == 8) ifTrue:[ |
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
131 |
^ self writePGMFileOn:outStream |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
132 |
]. |
2 | 133 |
]. |
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
134 |
^ Image cannotRepresentImageSignal |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
135 |
raiseWith:image |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
136 |
errorString:('PBMReader cannot represent this image'). |
46 | 137 |
|
138 |
" |
|
139 |
|img| |
|
140 |
||
141 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
142 |
img inspect. |
|
143 |
PBMReader save:img onFile:'test.pbm'. |
|
144 |
img := Image fromFile:'test.pbm'. |
|
145 |
img inspect. |
|
146 |
||
147 |
||
148 |
|img mono| |
|
149 |
||
150 |
img := Image fromFile:'bitmaps/garfield.gif'. |
|
151 |
img inspect. |
|
152 |
mono := img asMonochromeFormOn:Display. |
|
153 |
img := mono asImage. |
|
154 |
img inspect. |
|
155 |
PBMReader save:img onFile:'test.pbm'. |
|
156 |
img := Image fromFile:'test.pbm'. |
|
157 |
img inspect. |
|
158 |
" |
|
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
159 |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
160 |
"Modified: 14.10.1997 / 19:41:59 / cg" |
21 | 161 |
! |
162 |
||
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
163 |
writeCommonHeader:format on:aStream |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
164 |
"common header for P4, P5 and P5 formats" |
46 | 165 |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
166 |
aStream nextPutAll:format; cr. |
46 | 167 |
aStream nextPutAll:'# Converted from Smalltalk Form on '. |
168 |
aStream nextPutAll:Date today printString. |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
169 |
aStream nextPutAll:' at '; nextPutAll:Time now printString. |
46 | 170 |
aStream cr. |
171 |
aStream nextPutAll:width printString. |
|
172 |
aStream space. |
|
173 |
aStream nextPutAll:height printString. |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
174 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
175 |
"Created: 14.10.1997 / 20:01:05 / cg" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
176 |
! |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
177 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
178 |
writePBMFileOn:aStream |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
179 |
"Saves the receivers image on the file fileName in Portable Bitmap format." |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
180 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
181 |
self writeCommonHeader:'P4' on:aStream. |
46 | 182 |
aStream cr. |
183 |
||
184 |
aStream binary. |
|
185 |
photometric == #blackIs0 ifTrue:[ |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
186 |
aStream nextPutAll:data. |
46 | 187 |
] ifFalse:[ |
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
188 |
data invert. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
189 |
aStream nextPutAll:data. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
190 |
data invert. |
46 | 191 |
]. |
192 |
aStream close. |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
193 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
194 |
" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
195 |
|i i2| |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
196 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
197 |
i := Image fromFile:'bitmaps/SBrowser.xbm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
198 |
PBMReader save:i onFile:'foo.pbm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
199 |
i2 := Image fromFile:'foo.pbm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
200 |
i2 inspect. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
201 |
" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
202 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
203 |
"Modified: 14.10.1997 / 20:06:49 / cg" |
21 | 204 |
! |
205 |
||
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
206 |
writePGMFileOn:aStream |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
207 |
"Saves the receivers image on the file fileName in Portable Greymap format." |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
208 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
209 |
self writeCommonHeader:'P5' on:aStream. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
210 |
aStream space. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
211 |
aStream nextPutAll:255 printString. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
212 |
aStream cr. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
213 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
214 |
data size ~~ (width * height) ifTrue:[ |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
215 |
"/ self halt:'data size mismatch'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
216 |
]. |
200 | 217 |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
218 |
aStream binary. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
219 |
photometric == #blackIs0 ifTrue:[ |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
220 |
aStream nextPutAll:data. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
221 |
] ifFalse:[ |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
222 |
data invert. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
223 |
aStream nextPutAll:data. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
224 |
data invert. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
225 |
]. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
226 |
aStream close. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
227 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
228 |
" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
229 |
|i gI i2| |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
230 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
231 |
i := Image fromFile:'bitmaps/gifImages/garfield.gif'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
232 |
gI := i asFloydSteinbergDitheredGrayImageDepth:8. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
233 |
PBMReader save:gI onFile:'foo.pgm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
234 |
i2 := Image fromFile:'foo.pgm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
235 |
i2 inspect. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
236 |
" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
237 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
238 |
"Modified: 14.10.1997 / 20:06:58 / cg" |
200 | 239 |
! |
240 |
||
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
241 |
writePNMFileOn:aStream |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
242 |
"Saves the receivers image on the file fileName in Portable Anymap format." |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
243 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
244 |
self writeCommonHeader:'P6' on:aStream. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
245 |
aStream space. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
246 |
aStream nextPutAll:255 printString. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
247 |
aStream cr. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
248 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
249 |
data size ~~ (width * height * 3) ifTrue:[ |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
250 |
"/ self halt:'data size mismatch'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
251 |
]. |
200 | 252 |
|
709
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
253 |
aStream binary. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
254 |
aStream nextPutAll:data. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
255 |
aStream close. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
256 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
257 |
" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
258 |
|i i2| |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
259 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
260 |
i := Image fromFile:'bitmaps/granite.tiff'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
261 |
PBMReader save:i onFile:'foo.pnm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
262 |
i2 := Image fromFile:'foo.pnm'. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
263 |
i2 inspect. |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
264 |
" |
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
265 |
|
813553f7bd20
added write for P4, P5 and P6 formats.
Claus Gittinger <cg@exept.de>
parents:
679
diff
changeset
|
266 |
"Modified: 14.10.1997 / 20:07:08 / cg" |
2 | 267 |
! ! |
268 |