477 save:image onFile:aFileName |
477 save:image onFile:aFileName |
478 "save image as PBM/PGM/PNM file on aFileName" |
478 "save image as PBM/PGM/PNM file on aFileName" |
479 |
479 |
480 |bitsPerPixel| |
480 |bitsPerPixel| |
481 |
481 |
|
482 image mask notNil ifTrue:[ |
|
483 Image informationLostQuerySignal |
|
484 raiseWith:image |
|
485 errorString:('PBM format does not support an imageMask'). |
|
486 ]. |
|
487 |
482 outStream := FileStream newFileNamed:aFileName. |
488 outStream := FileStream newFileNamed:aFileName. |
483 outStream isNil ifTrue:[ |
489 outStream isNil ifTrue:[ |
484 'PBMReader [error]: file create error' errorPrintNL. |
490 'PBMReader [error]: file create error' errorPrintNL. |
485 ^ Image fileCreationErrorSignal |
491 ^ Image fileCreationErrorSignal |
486 raiseWith:image |
492 raiseWith:image |
487 errorString:('file creation error: ' , aFileName asString). |
493 errorString:('file creation error: ' , aFileName asString). |
488 ]. |
|
489 |
|
490 image mask notNil ifTrue:[ |
|
491 Image informationLostQuerySignal |
|
492 raiseWith:image |
|
493 errorString:('PBM format does not support an imageMask'). |
|
494 ]. |
494 ]. |
495 |
495 |
496 width := image width. |
496 width := image width. |
497 height := image height. |
497 height := image height. |
498 photometric := image photometric. |
498 photometric := image photometric. |
537 PBMReader save:img onFile:'test.pbm'. |
537 PBMReader save:img onFile:'test.pbm'. |
538 img := Image fromFile:'test.pbm'. |
538 img := Image fromFile:'test.pbm'. |
539 img inspect. |
539 img inspect. |
540 " |
540 " |
541 |
541 |
542 "Modified: 14.10.1997 / 19:41:59 / cg" |
542 "Modified: / 30.9.1998 / 23:30:43 / cg" |
543 ! |
543 ! |
544 |
544 |
545 writeCommonHeader:format on:aStream |
545 writeCommonHeader:format on:aStream |
546 "common header for P4, P5 and P5 formats" |
546 "common header for P4, P5 and P5 formats" |
547 |
547 |