[comp.lang.postscript] I need a finer setgray

eastick@hammer.me.toronto.edu (Doug Eastick) (01/03/89)

The gray that is closest to white (0.9) is too coarse for what I want
to do. The box that is being filled in is only about 1/4 inch square.
At a distance the gray looks fine, but up close (it's for Dept.
letterhead) the black dots are too big.

Here's the part to draw the "U" (it's scaled down later):
-------------------
/U
 {
 .9 setgray
 newpath
 2 34 moveto 34 34 lineto 34 0 lineto 2 0 lineto 2 34 lineto closepath fill
 newpath
 38 34 moveto 70 34 lineto 70 0 lineto 38 0 lineto 38 34 lineto closepath fill

 0 setgray
 newpath
 2 -2 moveto 2 0 lineto 34 0 lineto
 34 -34 lineto 34 -2 32 270 180 arcn closepath fill
 newpath
 38 -34 moveto 38 0 lineto 70 0 lineto 70 -2 lineto
 38 -2 32 0 270 arcn closepath fill
 } def
-------------------

If anyone has a routine that will fill the box with a fine gray, I
would appreciate it. Any help would be appreciated. 

Thanks.

-- 
Doug Eastick	eastick@me.UTORONTO.BITNET	UUCP: ...!utai!me!eastick
		eastick@me.toronto.edu

mar@athena.mit.edu (Mark A. Rosenstein) (01/05/89)

In article <21801.1989Jan3.12:29:38@hammer.me.toronto.edu> eastick@me.toronto.edu (Doug Eastick) writes:
>
>At a distance the gray looks fine, but up close (it's for Dept.
>letterhead) the black dots are too big.

The halftone screen used is defined by three parameters, the frequency
(dots per inch), angle (how the rows of dots line up), and a procedure
which determines the shape of the dots.  You can retrieve the current
values of these parameters with the currentscreen operator, and set
new ones with the setscreen operator.  For instance, the code fragment

	currentscreen 3 -1 roll 2 mul 3 1 roll setscreen

will double the number of dots/inch used.

HOWEVER, be warned that there is a reason the default was set the way
it is.  Finer dots may not print well in your print engine, and will
likely not copy well in a copier.  The default frequency is different
from printer to printer, and you will have to experiment some to see
if you can increse that frequency and still have output that looks
good.

A better solution is to design the logo so that you are happy with it
in draft form, then put a copy of that postscript file on a floppy and
take it to a typesetting service that has a real phototypesetter which
speaks postscript, such as a linotronic.  The same postscript file
printed on a phototypesetter instead of a laser printer will have a
much finer halftone pattern.  This output will be of a quality
suitable to use as a master for offset printing letterhead, as well.

					-Mark Rosenstein
					mar@athena.mit.edu

		 Variable won't and Constants aren't.

rcd@ico.ISC.COM (Dick Dunn) (01/05/89)

> The gray that is closest to white (0.9) is too coarse for what I want
> to do. The box that is being filled in is only about 1/4 inch square.
> At a distance the gray looks fine, but up close (it's for Dept.
> letterhead) the black dots are too big.

This isn't a characteristic of the particular gray level so much as it is a
characteristic of the halftone "screen size" or frequency--the spacing
between the dots (which does not vary with gray level).  It's easy to
change just the dot spacing.  300-dpi printers are likely to have a screen
frequency default value of 50-60 (meaning dot spacing is 1/50-1/60").

The setscreen and currentscreen operators manipulate the screen
characteristics.  To alter just the frequency and leave the other
characteristics alone--say, to set the screen frequency to 80, you could
use:
   currentscreen 3 -1 roll pop 80 3 1 roll setscreen

I suspect the reason that PostScript for 300-dpi printers uses such a
coarse screen is to get a reasonable number of gray levels.  If you crank
up the screen size to where there's only a handful of printer dots for each
halftone dot, it seriously limits the number of distinct gray levels.
Then, a picture which has a continuous shading from light to dark in a
region will come out looking like there are bands of gray, because the
steps between adjacent dot sizes aren't fine enough to fool the eye into
seeing a continuum.

Of course, that doesn't matter if you're just interested in one gray level,
as in the parent article.  You will probably find that you need to play
with the actual gray value once you change the screen frequency, since the
approximation you get with the new screen may be significantly lighter or
darker.  Also, don't try to crank it up too high or you'll run into
problems rendering the tiny dots--they may glop together or disappear.
(I've found write-white printers, like those based on the Ricoh engines, to
have more trouble here than write-black.)

If you have to fill specific straight-edged areas with gray, you may also
find it helpful to fiddle the screen angle (the angle between the rows of
halftone dots and horizontal) so that the screen angle is not aligned (or
nearly aligned) with any of the major edges.  If the area is bounded by
horizontal or vertical lines, the default screen angle should be fine.  If
it's, say, a diamond, you're likely to want to change it.  Screen angle is
another operand/result for setscreen/currentscreen; see your favorite red
book for details.
-- 
Dick Dunn      UUCP: {ncar,nbires}!ico!rcd           (303)449-2870
   ...Worst-case analysis must never begin with "No one would ever want..."

ram@umb.umb.edu (Robert Morris) (01/05/89)

Replying to a plea for better screening, mar@athena.mit.edu advises
typesetter output. I concur, but it has been my experience that a
random Linotronic and a random LaserWriter, even if both are well
maintained, have radically different transfer functions.  Contrasts
which are satisfactory on one are not necessarily satisfactory on the
other. You can expect to have to make several iterations with the
typesetter, twiddling the transfer function in your PostScript to
increase or decrease the contrast. Further, the final reproduction
process may also have substantial impact on the contrast, and what you
really can expect is the possiblity of iterating again. So don't leave
it until the last minute....

richard@gryphon.COM (Richard Sexton) (01/05/89)

In article <21801.1989Jan3.12:29:38@hammer.me.toronto.edu> eastick@me.toronto.edu (Doug Eastick) writes:
>
>At a distance the gray looks fine, but up close (it's for Dept.
>letterhead) the black dots are too big.

Get it set on a 2650 dpi Linotronic ?

/* mild personal nit to pick */

I'm getting real tired of seeing books, forms, and ad's in magazines
set with a laser printer instead of a phototypesetter.

That 3 volume O'reilly series about X-Windows, for exmaple is laser typeset,
and it doesnt look like a real book somehow.  More like a thick company
newsletter.

I can't help but feel that we're making negative progress here.

-- 
                              Hotel USENET
richard@gryphon.COM   {...}!gryphon!richard   gryphon!richard@elroy.jpl.nasa.gov