Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!usenet!mist.CS.ORST.EDU!kempkec From: kempkec@mist.CS.ORST.EDU (Christopher Kempke) Newsgroups: comp.graphics Subject: Re: RGB -> 16 grayscale Message-ID: <1991Mar19.115516.21440@lynx.CS.ORST.EDU> Date: 19 Mar 91 11:55:16 GMT References: <5083.669373541@ics.uci.edu> Sender: @lynx.CS.ORST.EDU Organization: Computer Science Department, Oregon State Univ. Lines: 33 Nntp-Posting-Host: mist.cs.orst.edu In article <5083.669373541@ics.uci.edu> wong@ICS.UCI.EDU (Wang-chan Wong) writes: >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 >while minimizing color collison at the same time? (i.e. I can still >view a 256 pictures in the 16 grayscales gas plasma screen.) > >Thanks in advance. -- wang Yes, easily. Assuming that those (red, green, blue) values are 0-255, you just divide the resultant value by 16, and you get 16 possible outcomes. Now just devide your available greys into 16 possibilities 0 = black, 15 = white. The fundamental "secret" here is that 256 colors will always map to (roughly) 256 greyscales, so you will HAVE to have multiple colors represented by the same grey (intensity) value. Just throw away the least significant bits (as many as necessary) to leave yourself with the number of intensity values you want. You ARE losing information this way, but there's no way to reflect the 256 colors with only 16 greys unless you halftone, dither, or use some other method which actually changes the pixel pattern. --Chris