public void buildColorTable ( int [ ] inPixels , int [ ] table ) { int count = inPixels . length ; maximumColors = table . length ; for ( int i = 0 ; i < count ; i ++ ) { insertColor ( inPixels [ i ] ) ; if ( colors > reduceColors ) reduceTree ( reduceColors ) ; } if ( colors > maximumColors ) reduceTree ( maximumColors ) ; buildColorTable ( root , table , 0 ) ; }
A quick way to use the quantizer . Just create a table the right size and pass in the pixels .