public class ColorQuantizer extends Object
Quantize class to work on BufferedImages
and handle transparency.| Modifier and Type | Class and Description |
|---|---|
static class |
ColorQuantizer.ColorReductionInfo
Indicates how many distinct colors an image has, whether it has partial trasparency
(alpha channel).
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_INDEXED_COLORS
Maximum number of colors in an indexed image, leaving one for transparency
|
| Constructor and Description |
|---|
ColorQuantizer() |
| Modifier and Type | Method and Description |
|---|---|
static ColorQuantizer.ColorReductionInfo |
getColorReductionInfo(BufferedImage source)
Returns a
ColorQuantizer.ColorReductionInfo for the provided image. |
static BufferedImage |
quantize(BufferedImage source)
Quantizes the image to
MAX_INDEXED_COLORS with white matte for areas with
partial transparency (full transparency will be preserved). |
static BufferedImage |
quantize(BufferedImage source,
Color matteColor)
Quantizes the image to
MAX_INDEXED_COLORS with the provided matte
Color for areas with partial transparency (full transparency will be
preserved). |
static BufferedImage |
quantize(BufferedImage source,
Color matteColor,
int maxColors)
Quantizes the image to the provided number of colors with the provided matte
Color for areas with partial transparency (full transparency will be
preserved). |
static BufferedImage |
reduce(BufferedImage source)
Reduces a direct color buffered image to an indexed color one without quality loss.
|
public static final int MAX_INDEXED_COLORS
public static BufferedImage quantize(BufferedImage source)
MAX_INDEXED_COLORS with white matte for areas with
partial transparency (full transparency will be preserved).BufferedImage with type BufferedImage.TYPE_BYTE_INDEXED and
quantized colorspublic static BufferedImage quantize(BufferedImage source, Color matteColor)
MAX_INDEXED_COLORS with the provided matte
Color for areas with partial transparency (full transparency will be
preserved).BufferedImage with type BufferedImage.TYPE_BYTE_INDEXED and
quantized colorspublic static BufferedImage quantize(BufferedImage source, Color matteColor, int maxColors)
Color for areas with partial transparency (full transparency will be
preserved).BufferedImage with type BufferedImage.TYPE_BYTE_INDEXED and
quantized colorspublic static BufferedImage reduce(BufferedImage source)
getColorReductionInfo(BufferedImage) method call.IllegalArgumentException - if the application of this method would result in
image quality losspublic static ColorQuantizer.ColorReductionInfo getColorReductionInfo(BufferedImage source)
ColorQuantizer.ColorReductionInfo for the provided image.Copyright © 2013 Carrot Search s.c.. All Rights Reserved.