Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!liuida!isy!lysator.liu.se!zap From: zap@lysator.liu.se (Zap Andersson) Newsgroups: comp.graphics Subject: Re: RGB to gray Message-ID: <406@lysator.liu.se> Date: 20 Nov 90 06:20:35 GMT References: <9011200035.AA21751@lilac.berkeley.edu> Sender: news@isy.liu.se (Lord of the News) Organization: Lysator Computer Club, Linkoping University, Sweden Lines: 60 twdorr01@ulkyvx.BITNET (ThomasD) writes: >In some article andrew@ee.su.oz.au (Andrew Ho) writes: >> I am trying to convert some full color images (RGB) into >>gray level images (because I hope to get some non-colorful >>laser printouts after doing the convertion). >> >> Are there any algorithms/lookup tables to do the "RGB to >>gray level" matching ? If I understood your question correctly: Gray = 0.39 * Red + 0.50 * Green + 0.11 * Blue... ...says the NTSC spec. I _*NEVER*_ got this to look goot, coz to my mind the blue turns out WAY to dark. Perhaps my eyes aren't NTSC standard, right? I use a beefed 0.30 Red + 0.50 Green + 0.20 Blue coz i like it better... >Or, (you're trying to print the RGB image to a laser printer, right?), >what I did in my laser routine was to use the common value as an index (in >conjunction with the X and Y coordinate of the pixel) into a look-up table >of bit map pixels (on and off) that matched the greyscale value as closely >as possible. The results were very nice, but I suspect there's a better way >to do it. Anybody know? >ThomasD Converting RGB to Gray is easy, as in the above... converting GRAY to halftone (i.e. black OR white dots like from a laser) ain't so easy... Dithering of sorts can be used, whoa, this is a whole field of science here.. You could use patterned dithering, either rastered like in a newspaper, where small dots grow larger as they grow darker, or you could use a dithermatrix where a gray pattern is 50% 75% 25% 01010101 01010101 00000000 10101010 11111111 10101010 01010101 01010101 00000000 10101010 11111111 10101010 But a pattern like this often introduces incredibly ugly stripes and moire effects.... Well, like I said, it's a science. My best shot at it is to convert the durn thing to postscript, and thump it in to the printer. That'll leave the problem to the printer (or at least the printer manufacturer ;-) /Z -- * * * * * * * * * * * * * * * * * * My signature is smaller than * * yours! - zap@lysator.liu.se * * * * * * * * * * * * * * * * * * -- * * * * * * * * * * * * * * * * * * My signature is smaller than * * yours! - zap@lysator.liu.se * * * * * * * * * * * * * * * * * *