[comp.lang.postscript] Help: ColorPS File -> B&W Printer

cerys@bbn.com (Daniel Cerys) (02/27/90)

I have a color Postscript file that I'd like to print on a B&W Postscript
printer.  Is there a simple utility that will convert the colors to the
appropriate grey scales?  The file's on a UNIX machine, but other
environments are available.

Please respond via email.

Thanks!
Dan

kent@wsl.dec.com (Christopher A. Kent) (02/28/90)

Just print it. The interpreter will take care of the dithering. That's
what device independence in PostScript is all about.

Chris Kent	Western Software Laboratory	Digital Equipment Corporation
kent@decwrl.dec.com	decwrl!kent			(415) 853-6639

amanda@mermaid.intercon.com (Amanda Walker) (02/28/90)

In article <2918@bacchus.dec.com>, kent@wsl.dec.com (Christopher A. Kent)
writes:
> Just print it. The interpreter will take care of the dithering. That's
> what device independence in PostScript is all about.

Well, but remember that color was added later.  What you need is a
definition for "colorimage" that you can download to your printer before
printing the file.  A version that's slow but accurate shouldn't be too
hard to write (she says, stciking her neck out :-))...

--
Amanda Walker
InterCon Systems Corporation

"Many of the truths we cling to depend greatly upon our own point of view."
	--Obi-Wan Kenobi in "Return of the Jedi"

tatar@boreas.crd.ge.com (robert tatar) (03/03/90)

Dan Cerys:

In a previous message you wrote:
>>I have a color Postscript file that I'd like to print on a B&W Postscript
>>printer.  Is there a simple utility that will convert the colors to the
>>appropriate grey scales?  The file's on a UNIX machine, but other
>>environments are available.

You didn't say if your "color Postscript" file used the "new" color extensions
(for color images) or not, but I assume it does.  I'm sure that you are aware
that the original postscript supports some color operations, such as for line
drawing, etc. and does color to gray scale conversion for those operations.

The good news is:
 1) I have written a "colorimage" (postscript!) operator for B&W printers.
 2) It uses the CIE color formula for conversion of RGB color to gray scale.
 3) It works.

I used this for testing a sun_raster_to_postscript program that I wrote.

The bad news is:
 1) It ONLY emulates one mode of the color image operator.
     (single procedure & RGB or "false 3" mode)
 2) It assumes 8 bits/pixel.
 3) It (necessarily) consumes virtual memory, which further limits the 
    raster size of the image.
 4) It is slow (as expected!).

If your files live within these constraints, I can send you the code.

It could be modified for other bits/pixel or other modes.  

The trickiest part is to take an arbitrary procedure that reads data for the
"colorimage" operator and replace it with a new procedure (proc) that passes
data to the "image" operator.  I don't know how robust my solution is, but it
works with a proc for the colorimage operator that uses run-length encoding
and a color map.  The output of this proc is a variable length string of
repeating RGBRGBRGB... bytes.  

I thought a little bit about making it more general and I disagree slightly
with Amanda Walker.  It is certainly possible, but I don't think it will be
easy to write.

If you know anyone interested in hacking this for the other modes, let me
know.

R. Tatar
tatar@crd.ge.com