j2d.color
Class MedianCut

java.lang.Object
  extended by j2d.color.MedianCut

public class MedianCut
extends java.lang.Object

Converts an RGB image to 8-bit index color using Heckbert's median-cut color quantization algorithm. Based on median.c by Anton Kruger from the September, 1994 issue of Dr. Dobbs Journal.


Constructor Summary
MedianCut(int[] pixels, int width, int height)
           
 
Method Summary
 java.awt.Image convert(int maxcubes)
           
 java.awt.Image get8BitImage()
           
 java.awt.Image get8BitImage(java.awt.image.BufferedImage bi)
          Using existing color lookup table, map image into a 256 color image.
static ImageProcessorInterface getImageProcessorInterface()
           
static MedianCut getMedianCut(java.awt.image.BufferedImage bi)
          For a bufferedImage instance, this will give an instance of the MedianCutclass.
 java.awt.Color getMostPopularColor()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MedianCut

public MedianCut(int[] pixels,
                 int width,
                 int height)
Method Detail

getMedianCut

public static MedianCut getMedianCut(java.awt.image.BufferedImage bi)
For a bufferedImage instance, this will give an instance of the MedianCutclass.

Parameters:
bi -
Returns:

getImageProcessorInterface

public static ImageProcessorInterface getImageProcessorInterface()

convert

public java.awt.Image convert(int maxcubes)

get8BitImage

public java.awt.Image get8BitImage(java.awt.image.BufferedImage bi)
Using existing color lookup table, map image into a 256 color image. If the color is not present, you will have to search the table.

Parameters:
bi -
Returns:

get8BitImage

public java.awt.Image get8BitImage()

getMostPopularColor

public java.awt.Color getMostPopularColor()