Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!celit!hutch From: hutch@fps.com (Jim Hutchison) Newsgroups: comp.graphics Subject: Re: RGB to gray (for a laser printer) Message-ID: <12945@celit.fps.com> Date: 20 Nov 90 21:49:19 GMT References: <9011200035.AA21751@lilac.berkeley.edu> Sender: daemon@fps.com Reply-To: hutch@fps.com (Jim Hutchison) Organization: FPS Computing Lines: 37 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 ? Assuming that you are not asking for Intensity = .59 G + .11 B + .30 R from the "Frequently Asked Questions" posting, I'll move directly on to another interpretation of your question. That being, why did the whites get so washed out and the shadow detail get shrouded in darkness? The process for correcting for anomalies in the grey ramp is a seriously difficult problem to do "right". Ofcourse, sleazy cheats abound, and produce results which may be good enough for you. A description of the implementation of the easiest of these sleazy hacks is as follows: An easy way to do the luminance calculation was by adding components from 3 tables, one each R, G, and B. Start with a 4th table of size 256 with entry 0..255 containing 0..255. Snap all the middle grey numbers to the range in which your printer performs well (e.g. for 20..230. Take entrys 4..250 and multiply them by 209 and divide by 255 and add 20). This snaps the range while making sure that blacks are black and whites are white. Then you just index the table with your luminance value and get a "new" and "improved" value. Lcorrected = Lum[ Rgrey[red] + Ggrey[green] + Bgrey[blue]] Clearly you could get out sampling equipment and tune the output by using different tables and/or dithering algorithms. Certain folks at Xerox and elsewhere have pursued this problem that way to good (if exhausting) results. -- - Jim Hutchison {dcdwest,ucbvax}!ucsd!fps!hutch Disclaimer: I am not an official spokesman for FPS computing