public final class DitheringMethod
extends com.aspose.ms.System.Enum
Dithering method.
The following example loads a raster image and performs threshold and floyd dithering using different palette depth.
String dir = "c:\\temp\\"; com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dir + "sample.png"); try { com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image; // Perform threshold dithering using 4-bit color palette which contains 16 colors. // The more bits specified the higher quality and the bigger size of the output image. // Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment. rasterImage.dither(com.aspose.imaging.DitheringMethod.ThresholdDithering, 4); rasterImage.save(dir + "sample.ThresholdDithering4.png"); } finally { image.dispose(); } image = com.aspose.imaging.Image.load(dir + "sample.png"); try { com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image; // Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white. // The more bits specified the higher quality and the bigger size of the output image. // Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment. rasterImage.dither(com.aspose.imaging.DitheringMethod.FloydSteinbergDithering, 1); rasterImage.save(dir + "sample.FloydSteinbergDithering1.png"); } finally { image.dispose(); }
Modifier and Type | Field and Description |
---|---|
static int |
FloydSteinbergDithering
The Floyd-Steinberg dithering.
|
static int |
ThresholdDithering
Threshold dithering.
|
Clone, CloneTo, format, format, get_Caption, get_Value, getName, getName, getNames, getNames, getNames, getUnderlyingType, getUnderlyingType, getValue, getValues, getValues, getValues, isDefined, isDefined, isDefined, isDefined, parse, parse, parse, parse, register, toObject, toString
public static final int ThresholdDithering
Threshold dithering. Simplest and fastest dithering algorithm.
public static final int FloydSteinbergDithering
The Floyd-Steinberg dithering. A more complex dithering algorithm, uses nearest neighbors intensity values.