org.apache.xmlgraphics.image.writer

## Class ImageWriterParams

- java.lang.Object
- - org.apache.xmlgraphics.image.writer.ImageWriterParams

-     public class ImageWriterParams
      extends java.lang.Object

  Parameters for the encoder which is accessed through the ImageWriter interface.
  Version:
    $Id$

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ONE_ROW_PER_STRIP` Used for generating exactly one strip for each row
    `static int` | `SINGLE_STRIP` Forces a single strip for the whole image.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageWriterParams()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getCompressionMethod()`
    `Endianness` | `getEndianness()` Returns the endianness selected for the image.
    `java.lang.Boolean` | `getJPEGForceBaseline()`
    `java.lang.Float` | `getJPEGQuality()`
    `java.lang.Integer` | `getResolution()`
    `ResolutionUnit` | `getResolutionUnit()` Returns the unit in which resolution values are given (ex.
    `int` | `getRowsPerStrip()` The number of rows per strip of the TIFF image, default 1.
    `java.lang.Integer` | `getXResolution()`
    `java.lang.Integer` | `getYResolution()`
    `boolean` | `hasResolution()`
    `boolean` | `isSingleStrip()` Checks if image is single strip (required by some fax processors).
    `void` | `setCompressionMethod(java.lang.String method)` Set the compression method that shall be used to encode the image.
    `void` | `setEndianness(Endianness endianness)` Sets the endianness selected for the image.
    `void` | `setJPEGQuality(float quality, boolean forceBaseline)` Sets the quality setting for encoding JPEG images.
    `void` | `setResolution(int resolution)` Sets the target resolution of the bitmap image to be written (sets both the horizontal and vertical resolution to the same value).
    `void` | `setResolutionUnit(ResolutionUnit resolutionUnit)` Sets the resolution unit of the image for calculating resolution.
    `void` | `setRowsPerStrip(int rowsPerStrip)` Sets the rows per strip (default is one row per strip); if set to -1 (single strip), will use height of the current page, required by some fax processors.
    `void` | `setSingleStrip(boolean isSingle)` Convenience method to set rows per strip to single strip, otherwise sets to one row per strip.
    `void` | `setXResolution(int resolution)` Sets the target horizontal resolution of the bitmap image to be written.
    `void` | `setYResolution(int resolution)` Sets the target vertical resolution of the bitmap image to be written.

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

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

- - ### Field Detail

    - #### SINGLE_STRIP

          public static final int SINGLE_STRIP

      Forces a single strip for the whole image.
      See Also:
        Constant Field Values

    - #### ONE_ROW_PER_STRIP

          public static final int ONE_ROW_PER_STRIP

      Used for generating exactly one strip for each row
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ImageWriterParams

          public ImageWriterParams()

      Default constructor.

  - ### Method Detail

    - #### hasResolution

          public boolean hasResolution()

      Returns:
        true if resolution has been set

    - #### getResolution

          public java.lang.Integer getResolution()

      Returns:
        the image resolution in dpi, or null if undefined

    - #### getJPEGQuality

          public java.lang.Float getJPEGQuality()

      Returns:
        the quality value for encoding a JPEG image (0.0-1.0), or null if undefined

    - #### getJPEGForceBaseline

          public java.lang.Boolean getJPEGForceBaseline()

      Returns:
        true if the baseline quantization table is forced, or null if undefined.

    - #### getCompressionMethod

          public java.lang.String getCompressionMethod()

      Returns:
        the compression method for encoding the image

    - #### setResolution

          public void setResolution(int resolution)

      Sets the target resolution of the bitmap image to be written (sets both the horizontal and vertical resolution to the same value).
      Parameters:
        `resolution` - the resolution

    - #### setJPEGQuality

          public void setJPEGQuality(float quality,
                                     boolean forceBaseline)

      Sets the quality setting for encoding JPEG images.
      Parameters:
        `quality` - the quality setting (0.0-1.0)
        `forceBaseline` - force baseline quantization table

    - #### setCompressionMethod

          public void setCompressionMethod(java.lang.String method)

      Set the compression method that shall be used to encode the image.
      Parameters:
        `method` - the compression method

    - #### isSingleStrip

          public boolean isSingleStrip()

      Checks if image is single strip (required by some fax processors).
      Returns:
        true if one row per strip.

    - #### setSingleStrip

          public void setSingleStrip(boolean isSingle)

      Convenience method to set rows per strip to single strip, otherwise sets to one row per strip.
      Parameters:
        `isSingle` - true if a single strip shall be produced, false if multiple strips are ok

    - #### setRowsPerStrip

          public void setRowsPerStrip(int rowsPerStrip)

      Sets the rows per strip (default is one row per strip); if set to -1 (single strip), will use height of the current page, required by some fax processors.
      Parameters:
        `rowsPerStrip` - the value to set.

    - #### getRowsPerStrip

          public int getRowsPerStrip()

      The number of rows per strip of the TIFF image, default 1. A value of -1 indicates a single strip per page will be used and RowsPerStrip will be set to image height for the associated page.
      Returns:
        the number of rows per strip, default 1.

    - #### getResolutionUnit

          public ResolutionUnit getResolutionUnit()

      Returns the unit in which resolution values are given (ex. units per inch).
      Returns:
        the resolution unit.

    - #### setResolutionUnit

          public void setResolutionUnit(ResolutionUnit resolutionUnit)

      Sets the resolution unit of the image for calculating resolution.
      Parameters:
        `resolutionUnit` - the resolution unit (inches, centimeters etc.)

    - #### getXResolution

          public java.lang.Integer getXResolution()

      Returns:
        the horizontal image resolution in the current resolution unit, or null if undefined

    - #### setXResolution

          public void setXResolution(int resolution)

      Sets the target horizontal resolution of the bitmap image to be written.
      Parameters:
        `resolution` - the resolution value

    - #### getYResolution

          public java.lang.Integer getYResolution()

      Returns:
        the vertical image resolution in the current resolution unit, or null if undefined

    - #### setYResolution

          public void setYResolution(int resolution)

      Sets the target vertical resolution of the bitmap image to be written.
      Parameters:
        `resolution` - the resolution value

    - #### getEndianness

          public Endianness getEndianness()

      Returns the endianness selected for the image.
      Returns:
        the endianness

    - #### setEndianness

          public void setEndianness(Endianness endianness)

      Sets the endianness selected for the image.
      Parameters:
        `endianness` - the endianness

Copyright 1999-2025 The Apache Software Foundation. All Rights Reserved.