Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!sgi!shinobu!odin!tom.dallas.sgi.com!fouts From: fouts@tom.dallas.sgi.com (Christopher L. Fouts) Newsgroups: comp.sys.sgi Subject: Re: Fooling with 'tops' and 'imgexp' utilities Message-ID: <1991Apr11.225728.28562@odin.corp.sgi.com> Date: 11 Apr 91 22:57:28 GMT References: <1991Apr10.010515.19951@leland.Stanford.EDU> Sender: news@odin.corp.sgi.com (Net News) Reply-To: fouts@tom.dallas.sgi.com (Christopher L. Fouts) Organization: Silicon Graphics, Inc. (Dallas) Lines: 38 In article <1991Apr10.010515.19951@leland.Stanford.EDU>, dhinds@portia.Stanford.EDU (David Hinds) writes: |> I'm curious about the parameters for the 'tops' program. I remember reading |> that the default halftone screens on Laserwriters were very nonoptimal; are |> there some values that work better with 'tops', or are its defaults as good |> as they can be? Also, I can't seem to get a plain white background with my |> printed images. I used the 'invert' program to flip the screen black to |> white, but it comes out as a sparse dot pattern on our laser printer. So, |> I tried using 'imgexp {files} 10 245' to force the very light and very dark |> areas to true white and black. When I look at the images before and after |> with 'hist', however, they seem to have exactly the same grey scale ranges! |> There are still lots of vertices with grey values in the 251..254 range. |> 'imgexp' does seem to work if I ask for more extreme range reductions. There is a slight bug (feature?) in the routine to convert RGB to black and white. In tops.c (as of 3.3.2), the routine rgbrowtobw has the following line: *obuf++ = (77*(*rbuf++) + 150*(*gbuf++) + 28*(*bbuf++))>>8; Notice that for a gray RGB value (rbuf = gbuf = bbuf = value ), this is the same as *obuf = ( (77+150+28) * value ) >> 8 ; or = ( 255 * value ) / 256 Thus white RGB values (value = 255) get rounded off to 254, which results in a very sparse dithering. Correct this by adding 1 to the constant of your choice, such that the total is 256, as in *obuf++ = (77*(*rbuf++) + 150*(*gbuf++) + 29*(*bbuf++))>>8; ^^ -- Chris L. Fouts email: fouts@dallas.sgi.com Systems Engineer vmail: 8714 SGI - Dallas phone: 214-788-4122 "To me, boxing is like a ballet except that there is no dancing, no choreography, and the dancers hit each other." - Saturday Night Live