org.apache.fop.util.bitmap

## Class JAIMonochromeBitmapConverter

- java.lang.Object
- - org.apache.fop.util.bitmap.JAIMonochromeBitmapConverter

- All Implemented Interfaces:
    MonochromeBitmapConverter

      public class JAIMonochromeBitmapConverter
      extends Object
      implements MonochromeBitmapConverter

  Implementation of the MonochromeBitmapConverter which uses Java Advanced Imaging (JAI) to convert grayscale bitmaps to monochrome bitmaps. JAI provides better dithering options including error diffusion dithering.

  If you call setHint("quality", "true") on the instance you can enabled error diffusion dithering which produces a nicer result but is also a lot slower.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JAIMonochromeBitmapConverter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RenderedImage` | `convertToMonochrome(BufferedImage img)` Converts a bitmap image to a monochrome (1-bit) b/w bitmap image.
    `void` | `setHint(String name, String value)` Sets a hint to the implementation

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

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

- - ### Constructor Detail

    - #### JAIMonochromeBitmapConverter

          public JAIMonochromeBitmapConverter()

  - ### Method Detail

    - #### setHint

          public void setHint(String name,
                              String value)

      Sets a hint to the implementation
      Specified by:
        `setHint` in interface `MonochromeBitmapConverter`
      Parameters:
        `name` - the name of the hint
        `value` - the value

    - #### convertToMonochrome

          public RenderedImage convertToMonochrome(BufferedImage img)

      Converts a bitmap image to a monochrome (1-bit) b/w bitmap image.
      Specified by:
        `convertToMonochrome` in interface `MonochromeBitmapConverter`
      Parameters:
        `img` - the original image
      Returns:
        the converted monochrome image

Copyright © 2025 Apache Software Foundation. All rights reserved.