Class Dithering
- java.lang.Object
-
- org.apache.commons.imaging.palette.Dithering
-
public final class Dithering extends java.lang.ObjectDithering algorithms to use when quantizing an image to palette form.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateDithering()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static intadjustPixel(int argb, int errA, int errR, int errG, int errB, int mul)static voidapplyFloydSteinbergDithering(java.awt.image.BufferedImage image, Palette palette)Changes the given image to only use colors from the given palette, applying Floyd-Steinberg dithering in the process.
-
-
-
Method Detail
-
adjustPixel
private static int adjustPixel(int argb, int errA, int errR, int errG, int errB, int mul)
-
applyFloydSteinbergDithering
public static void applyFloydSteinbergDithering(java.awt.image.BufferedImage image, Palette palette) throws ImagingExceptionChanges the given image to only use colors from the given palette, applying Floyd-Steinberg dithering in the process. Ensure that your alpha values in the image and in the palette are consistent.- Parameters:
image- the image to changepalette- the palette to use- Throws:
ImagingException- if it fails to read the palette index
-
-