j2d.color
Class MedianCut
java.lang.Object
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)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MedianCut
public MedianCut(int[] pixels,
int width,
int height)
getMedianCut
public static MedianCut getMedianCut(java.awt.image.BufferedImage bi)
- For a bufferedImage instance, this will give
an instance of the
MedianCut
class.
- Parameters:
bi
-
- Returns:
- an instance of the MedianCut Class
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:
- 8 bit bufferedImage
get8BitImage
public java.awt.Image get8BitImage()
getMostPopularColor
public java.awt.Color getMostPopularColor()