[comp.windows.news] writecanvas and bw ?

fgreco@slcpi.shearson.com (Frank Greco) (08/01/90)

Does anyone know how to make writecanvas write out 
1-bit bw images instead of 8-bit color images?  

In effect, I'd like to run rasfilter8to1(1) on the
image before it gets written out.


Thanks all,



+-----------------------------------+-----------------------------------+
|Frank D. Greco - Consultant        |                                   |
|                                   |                                   |
|On Assignment at:                  |Office:                            |
| Shearson Lehman Brothers          | Crossroads Technologies, Inc.     |
| World Financial Center, 11th Floor| PO Box 530                        |
| New York City, NY 10007           | Fanwood, NJ 07023                 |
|                                   |                                   |
| email: fgreco@shearson.com        | email: frank5@mars.njit.edu       |
| voice: (212) 528-6122             | voice: (201)-754-7820             |
+-----------------------------------+-----------------------------------+

My comments reflect my own opinions, not my clients.
-- 


+-----------------------------------+-----------------------------------+
|Frank D. Greco - Consultant        |                                   |

naughton@wind.Eng.Sun.COM (Patrick Naughton) (08/03/90)

In article <1990Aug1.154745.7682@shearson.com>,
fgreco@slcpi.shearson.com (Frank Greco) writes:
|> 
|> Does anyone know how to make writecanvas write out 
|> 1-bit bw images instead of 8-bit color images?  
|> 
|> In effect, I'd like to run rasfilter8to1(1) on the
|> image before it gets written out.
|> 
|> 
|> Thanks all,
|> |Frank D. Greco - Consultant

There is no option to writecanvas to do this per se, but this should work.

/ccan (/tmp/foo.im8) readcanvas def
ccan setcanvas
matrix currentmatrix		% figure out how big the color canvas is.
dup 0 get exch 5 get		% w h
1 [] null buildimage setcanvas	% create a mono canvas the same size.
ccan imagecanvas		% copy the color canvas onto the mono one.
(/tmp/foo.im1) writecanvas	% write the mono canvas.

-Patrick

    ______________________________________________________________________
    Patrick J. Naughton				    ARPA: naughton@sun.com
    Window Systems Group			    UUCP: ...!sun!naughton
    Sun Microsystems, Inc.			    AT&T: (415) 336 - 1080