Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!rutgers!apple!well!ewhac From: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) Newsgroups: comp.sys.amiga.tech Subject: Re: Color compression routines (4096 to 256) wanted. Keywords: HAM, 256 color, Amiga, Sun Message-ID: <11430@well.UUCP> Date: 27 Apr 89 08:58:39 GMT References: <33747@kilowatt.uucp> Reply-To: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) Organization: :noitazinagrO Lines: 34 Quote: "Ho! Ha! Guard! Turn! Parry! Dodge! Spin! Ha! Thrust! " In article <33747@kilowatt.uucp> raz@kilowatt.uucp (Raz- Berry) writes: > I need a basic flowchart > on taking a 4096 color palette and converting it down to > 256. Initially I was thinking that: > > 1) Sort the file by pixel color (emulating HAM mode of course). > eg. how many reds? how many purples? how many puke greens? > 2) take the largest number of pixels per color, and assign them their > very own color register (up to 256). > 3) take any remaining colors (if we have exceeded the 256 available colors) > and perform the 'best fit' with the current palette. > Permit me to poke a hole in this. Suppose I have a simple HAM picture. The left half of the screen is various hues of purple, and the right half of the screen is various hues of blue. Separating these two fields is a vertical line, one pixel wide, that is solid white. Now, if you were to do a histogram on this image, you'd probably find the most popular 256 entries were hues of purple and blue, and white would be right at the bottom of the list. However, that white line is a prominent feature, because of its contrast with the rest of the image. So picking colors for a reduced bitmap isn't all that simple. I had to attack similar problems when writing some internal tools when we were developing Roger Rabbit. I strongly recommend you get yourself a book on image processing (something I should have done). _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ Leo L. Schwab -- The Guy in The Cape INET: well!ewhac@ucbvax.Berkeley.EDU \_ -_ Recumbent Bikes: UUCP: pacbell > !{well,unicom}!ewhac O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack") "Work FOR? I don't work FOR anybody! I'm just having fun." -- The Doctor