Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!halluc!malak From: malak@halluc.com (Michael Malak) Newsgroups: comp.graphics Subject: Rgb -> 16 grayscale Message-ID: <58.27ECA443@halluc.com> Date: Sat, 23 Mar 91 12:32:00 EST Organization: The Hallucination BBS, Fairfax VA (703) 425-5824 -> Hi, I am working on a project that requires to display 256 colors -> with a 16 levels grayscale (as with a gas plasma screen.) I -> understand that the following formula will compute the corresponding -> of graylevel given the rgb intensity: -> -> grayscale= .299*red+ .587*green + .114*blue -> -> However, given 256 colors, this formula still maps onto more than 16 -> distinct grayscales. My question is: how to map exactly onto 16 -> grayscales? Are there any algorithms that map onto 16 grayscales First, sort the 256 colors on their greyscale equivalent, then tally up how many pixels there are in the image for each of the 256 colors. Then break this "histogram" into 16 equal parts (equal number of pixels per "part"; the tallies help you do this). So for each of the 16 parts you have to come up with a greyscale value for it; simply do an average weighted by the number of pixels associated with each original greyscale. You may also want to consider F&S dithering, with or without the above technique. -- Michael Malak -- sysop of Hallucination UUCP: ...!uunet!halluc!malak INTERNET: malak@halluc.com