Package org.apache.commons.imaging.palette

# Class Dithering

java.lang.Object
org.apache.commons.imaging.palette.Dithering

public final class Dithering extends Object
Dithering algorithms to use when quantizing an image to palette form.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `applyFloydSteinbergDithering(BufferedImage image, Palette palette)`
  Changes the given image to only use colors from the given palette, applying Floyd-Steinberg dithering in the process.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### applyFloydSteinbergDithering

    public static void applyFloydSteinbergDithering(BufferedImage image, Palette palette) throws ImagingException
    Changes 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 change
      `palette` - the palette to use
    Throws:
      `ImagingException` - if it fails to read the palette index