From: legalize@xmission.xmission.com (Phil McRevis) Subject: Re: RGB value conversion Date: 02 Jun 1999 00:00:00 GMT Message-ID: <7j4fuk$dru$1@xmission.xmission.com> References: <3755B5E7.1041B552@usa.net> X-Complaints-To: abuse@xmission.com X-Trace: news.xmission.com 928367382 6586 198.60.22.20 (2 Jun 1999 23:49:42 GMT) Organization: multi-cellular, biological X-Reply-Etiquette: No copy by email, please Reply-To: legalize@xmission.xmission.com (Phil McRevis) NNTP-Posting-Date: 2 Jun 1999 23:49:42 GMT Newsgroups: comp.graphics.algorithms Robin Johnson spake the secret code <3755B5E7.1041B552@usa.net> thusly: >I need to convert 24 bit (8:8:8) RGB values to 16 & 15 bit values >(5:6:5) and (5:5:5), while still keeping the scale similar so that the >image looks right. You'll get best results by using a combination of quantization and dithering for this conversion. You're going to lose precision in going from 8:8:8 to 5:[56]:5, that's just a fact of life for this kind of conversion -- you're quantizing an 8 bit channel to a fewer number of possible values, either 5 or 6 bits. After you've quantized a pixel, there will be an error term representing the difference between the original 8:8:8 pixel and the 5:[56]:5 pixel. Use this error term in a dithering algorithm of your choice to distribute the error in a region around the quantized pixel. Floyd-Steinberg dithering would probably work nicely, but if you have a restricted set of images you may find other dithering algorithms give better subjective results based on the image. -- http://www.xmission.com/~legalize Legalize Adulthood! legalize@xmission.com ``Ain't it funny that they all fire the pistol,