Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!dn0o+ From: dn0o+@andrew.cmu.edu (Derek Brooks Noonburg) Newsgroups: comp.sys.amiga.tech Subject: Re: Selecting HAM mode base colours Message-ID: <4aWa2Kq00WB54O5W99@andrew.cmu.edu> Date: 28 Jun 90 19:55:02 GMT Organization: Class of '91, Carnegie Mellon, Pittsburgh, PA Lines: 26 I believe something like this went by on comp.sys.graphics about a year ago. They suggested the median cut algorithm devised by Paul Heckbert (I think). It was published in a SIGGRAPH Proceedings a couple years ago -- send me email and I'll look up the exact issue (it's at home). The basic idea is to create a histogram of RGB space (i.e., 16x16x16 array where each element is the number of pixels of that color). Then choose the direction (R/G/B) with the widest span. Split the histogram at the median color along that direction. Repeat this recursively (using the regions created by your previous splits instead of the whole histogram) until you have 16 (or however many) colors. I use this method for my own GIF viewer and it works quite well. Actually, the 32-color lo-res images look almost as good as HAM. I can send the code, if you want. BTW, If you have a good way of generating HAM colors (the actual pixel values) once you have the base colors, I'd be interested in hearing about it. - Derek ========================================================================== Derek Noonburg | ARPA: dn0o+@andrew.cmu.edu Junior - Computer Engineering | BITNET: dn0o+@andrew / dn0o+%andrew@cmccvb Carnegie Mellon University | UUCP: ...harvard!andrew.cmu.edu!dn0o+ USMail: Box 967; 5115 Margaret Morrison St.; Pittsburgh, PA 15213 ==========================================================================