[comp.lang.postscript] Printing bitmaps in postscript

glenn@heaven.woodside.ca.us (Glenn Reid) (07/06/90)

In article <1990Jul5.172746.10305@dvinci.usask.ca> eric@dvinci.usask.ca (Eric Neufeld) writes:
>I am experimenting with halftoning algorithms, i.e., don't necessary want
>to use the screen built into postscript.  Thus, I'm generating my
>own bitmaps and printing them to an Apple postscript lasterwriter.
>
>But the printer frequently *just doesn't print* and leaves me no clues.
>
>Any ideas of where to start troubleshooting?  I have checked my image
>dimensions a zillion times, but I expect there is something simple that I
>am missing.  Except for the arguements to the image operator, the programs
>are identical.

You should read some sections from the "Green Book" (I forget which ones).
Far and away the most common reason for the image not printing anything
is the size of your image buffer (the innocent looking string that is
often called "bufstr" or something similar.  The simplest way to get good
results is to make sure that this string exactly holds one scan line of
your image.  That requires a little bit of thought unless you have an
8-bit image, since the image string is in bytes and your image is in bits.
If it's an 8-bit image, then the string should have one byte for each
sample in the width of the image.

If you should happen to use a larger string, for example, two scan-lines
worth, then you have to have an even number of scan lines to avoid
reading too much data and reading right through the end of the file.

This is an oversimplified answer, but check out the discussion in the
green book and check the length of your buffer string carefully.

Send me note if you're still stuck.

Glenn

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		Unparalleled Quality

clewis@eci386.uucp (Chris Lewis) (07/07/90)

In article <1990Jul5.172746.10305@dvinci.usask.ca> eric@dvinci.usask.ca (Eric Neufeld) writes:
> I am experimenting with halftoning algorithms, ...
 
> But the printer frequently *just doesn't print* and leaves me no clues.
 
> Any ideas of where to start troubleshooting?

Most postscript printers will transmit back up the serial line to the
computer various diagnostics.  Eg: if you had a postscript printer hung off
/dev/ttyab, you could spawn a "cat /dev/ttyab > /tmp/logfile" in
the background and examine /tmp/logfile after your file blackholes.
Note: depending on a number of things, you may have to write this
as a C program that setbuf's output as unbuffered or something so
that you see the output as soon as the printer spits it back.

Alternately, you can use "ehandler.ps" which will print a stack
traceback onto paper on error.  This gets posted frequently, so
you should be able to find it.
-- 
Chris Lewis, Elegant Communications Inc, {uunet!attcan,utzoo}!lsuc!eci386!clewis
Ferret mailing list: eci386!ferret-list, psroff mailing list: eci386!psroff-list