Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.addon.optimization.ImageSettings Class Reference
Inheritance diagram for com.foxit.sdk.addon.optimization.ImageSettings:

## Public Member Functions
| ImageSettings ()
| Constructor. More...
| ImageSettings (ImageSettings other)
| Constructor, with another image settings object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
boolean | isEmpty ()
| Check whether current object is empty or not. More...
void | setBackgroundDownScale (int down_scale) throws com.foxit.sdk.PDFException
| Set the background downscale value for lossy compression modes, used for optimizing color images in a PDF document. More...
void | setCompressionMode (int mode) throws com.foxit.sdk.PDFException
| Set compression mode used for optimizing color/gray images in a PDF document. More...
void | setForegroundDownScale (int down_scale) throws com.foxit.sdk.PDFException
| Set the foreground downscale value for lossy compression modes, used for optimizing color images in a PDF document. More...
void | setImageDPI (int dpi) throws com.foxit.sdk.PDFException
| Set the DPI value as the target compressed value for compressing color/gray images in a PDF document. More...
void | setImageDPILimit (int dpi_limit) throws com.foxit.sdk.PDFException
| Set the lower limit DPI value for the color/gray image to decide if the image is to be compressed in a PDF document. More...
void | setQuality (int quality) throws com.foxit.sdk.PDFException
| Set the quality for lossy compression modes, used for optimizing color/gray images in a PDF document. More...
void | setStretchMode (int mode) throws com.foxit.sdk.PDFException
| Set stretch mode used for optimizing color/gray images in a PDF document. More...
void | setTextSensitivity (int text_sensitivity) throws com.foxit.sdk.PDFException
| Set the text sensitivity for lossy compression modes, used for optimizing color images in a PDF document. More...
void | setTileSize (int size) throws com.foxit.sdk.PDFException
| Set the tile size for JPEG2000 compression modes, used for optimizing color/gray images in a PDF document. More...

## Static Public Attributes
static final int | e_ImageCompressHigh = 10003
| Compression mode: high. This flag will be invalid if the image dpi is less than 200.
static final int | e_ImageCompressjpeg = 10005
| Compression mode: jpeg.
static final int | e_ImageCompressjpeg2000 = 10006
| Compression mode: jpeg2000.
static final int | e_ImageCompressQualityHigh = 4
| Compression quality: High.
static final int | e_ImageCompressQualityLossless = 6
| Compression quality: Lossless, only for jpeg2000 compress mode.
static final int | e_ImageCompressQualityLow = 2
| Compression quality: Low.
static final int | e_ImageCompressQualityMaximum = 5
| Compression quality: Maximum.
static final int | e_ImageCompressQualityMedium = 3
| Compression quality: Medium.
static final int | e_ImageCompressQualityMinimum = 1
| Compression quality: Minimum.
static final int | e_ImageCompressRetain = 10007
| Compression mode: retain, which means no compression.
static final int | e_ImageCompressZip = 10009
| Compression mode: zip.
static final int | e_StretchBicubic = 0x80
| When this is set, that means to do bicubic interpolation for zooming.
static final int | e_StretchDefault = -1
| When this is set, that means to do default stretching.
static final int | e_StretchDownsample = 0x04
| When this is set, that means not to do halftone for shrinking or rotating.
static final int | e_StretchInterpol = 0x20
| When this is set, that means to do interpolation for zooming.
static final int | e_StretchNoSmooth = 0x100
| When this is set, that means not to do any interpolation for stretching.
static final int | e_StretchOff = 0x00
| When this is set, that means to do without stretching.

## Detailed Description

This class represents downsampling/recompression settings for color and grayscale images. This class object can be set to class OptimizerSettings and then be used to optimize a PDF document.

See also
  OptimizerSettings

## Constructor & Destructor Documentation

## ◆ ImageSettings() [1/2]

com.foxit.sdk.addon.optimization.ImageSettings.ImageSettings | ( |  | ) |

Constructor.

This constructor is to construct a color/gray image settings object with default setting options. User can also call "set" methods in this class to change these setting options. Please refer to comment of these "set" methods for more details about default values.

## ◆ ImageSettings() [2/2]

com.foxit.sdk.addon.optimization.ImageSettings.ImageSettings | ( | ImageSettings | other | ) |

Constructor, with another image settings object.

Parameters

  [in] | other | Another image settings object.

## Member Function Documentation

## ◆ delete()

synchronized void com.foxit.sdk.addon.optimization.ImageSettings.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

Reimplemented from com.foxit.sdk.common.Base.

## ◆ isEmpty()

boolean com.foxit.sdk.addon.optimization.ImageSettings.isEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ setBackgroundDownScale()

void com.foxit.sdk.addon.optimization.ImageSettings.setBackgroundDownScale | ( | int | down_scale | ) | throws com.foxit.sdk.PDFException

Set the background downscale value for lossy compression modes, used for optimizing color images in a PDF document.

This function is used to reduce the resolution of the background image.

Parameters

  [in] | down_scale | Background downscale value for lossy compression modes. It should be above 0. If the value is 1, the background resolution is not reduced. If the value is larger than 1, the higher the value, the lower the background resolution. If this function is not called to set this option, that means to use 3 as the default value of this option.

Returns
  None.

## ◆ setCompressionMode()

void com.foxit.sdk.addon.optimization.ImageSettings.setCompressionMode | ( | int | mode | ) | throws com.foxit.sdk.PDFException

Set compression mode used for optimizing color/gray images in a PDF document.

For a newly constructed object, if this function is not called to set option, that means to use com.foxit.sdk.addon.optimization.ImageSettings.e_ImageCompressjpeg as the default value of this option.

Parameters

  [in] | mode | Image compression mode. Please refer to values starting from com.foxit.sdk.addon.optimization.ImageSettings.e_ImageCompressHigh and this should be one of these values.

Returns
  None.

## ◆ setForegroundDownScale()

void com.foxit.sdk.addon.optimization.ImageSettings.setForegroundDownScale | ( | int | down_scale | ) | throws com.foxit.sdk.PDFException

Set the foreground downscale value for lossy compression modes, used for optimizing color images in a PDF document.

This function is used to reduce the resolution of the foreground image.

Parameters

  [in] | down_scale | Foreground downscale value for lossy compression modes. It should be above 0. If the value is 1, the foreground resolution is not reduced. If the value is larger than 1, the higher the value, the lower the foreground resolution. If this function is not called to set this option, that means to use 3 as the default value of this option.

Returns
  None.

## ◆ setImageDPI()

void com.foxit.sdk.addon.optimization.ImageSettings.setImageDPI | ( | int | dpi | ) | throws com.foxit.sdk.PDFException

Set the DPI value as the target compressed value for compressing color/gray images in a PDF document.

When an image can be compressed, the resolution of this image will be compressed to the DPI value set by current function.
For a newly constructed object, if this function is not called to set option, that means to use 150 as the default value of this option.

Parameters

  [in] | dpi | DPI value which is set to be the target compressed DPI value.

Returns
  None.

## ◆ setImageDPILimit()

void com.foxit.sdk.addon.optimization.ImageSettings.setImageDPILimit | ( | int | dpi_limit | ) | throws com.foxit.sdk.PDFException

Set the lower limit DPI value for the color/gray image to decide if the image is to be compressed in a PDF document.

If the resolution of an image in the PDF document is above the lower limit DPI value, this image will be compressed to the target compressed DPI value which is set by function ImageSettings.setImageDPI .
For a newly constructed object, if this function is not called to set option, that means a DPI value (which is 1.5 times of target compressed DPI value) will be used as the default value of this option.

Parameters

  [in] | dpi_limit | DPI value as the lower limit. This value should be a positive number. Suggested range: bigger than target compressed DPI value (set by function ImageSettings.setImageDPI ) and the maximum value is 10 times of target compressed DPI value. If input value is not bigger than the target compressed DPI value, a DPI value which is one more than the target compressed DPI value will be used instead. If input value is bigger than the maximum value, the maximum value value will be used instead.

Returns
  None.

## ◆ setQuality()

void com.foxit.sdk.addon.optimization.ImageSettings.setQuality | ( | int | quality | ) | throws com.foxit.sdk.PDFException

Set the quality for lossy compression modes, used for optimizing color/gray images in a PDF document.

For a newly constructed object, if this function is not called to set this option, that means to use com.foxit.sdk.addon.optimization.ImageSettings.e_ImageCompressQualityMinimum as the default value of this option.

Parameters

  [in] | quality | Quality value for lossy compression modes. Please refer to values starting from com.foxit.sdk.addon.optimization.ImageSettings.e_ImageCompressQualityMinimum and this should be one of these values.

Returns
  None.

## ◆ setStretchMode()

void com.foxit.sdk.addon.optimization.ImageSettings.setStretchMode | ( | int | mode | ) | throws com.foxit.sdk.PDFException

Set stretch mode used for optimizing color/gray images in a PDF document.

For a newly constructed object, if this function is not called to set this option, that means to use com.foxit.sdk.addon.optimization.ImageSettings.e_StretchBicubic as the default value of this option.

Parameters

  [in] | mode | Stretch mode. Please refer to values starting from com.foxit.sdk.addon.optimization.ImageSettings.e_StretchOff and this should be one of these values.

Returns
  None.

## ◆ setTextSensitivity()

void com.foxit.sdk.addon.optimization.ImageSettings.setTextSensitivity | ( | int | text_sensitivity | ) | throws com.foxit.sdk.PDFException

Set the text sensitivity for lossy compression modes, used for optimizing color images in a PDF document.

This function affects the segmentation into foreground (usually text) and background. if this function is not called to set this option, that means to use 60 as the default value of this option.

Parameters

  [in] | text_sensitivity | The value of text sensitivity. A higher sensitivity value results in more content represented in the foreground. The value is especially important in case of documents with low contrast and documents with patterns, images or color in background. Instead, the effect on simple text documents with high contrast, clear bright background and sharp dark symbols is low. Valid values: from 0 to 100.

Returns
  None.

## ◆ setTileSize()

void com.foxit.sdk.addon.optimization.ImageSettings.setTileSize | ( | int | size | ) | throws com.foxit.sdk.PDFException

Set the tile size for JPEG2000 compression modes, used for optimizing color/gray images in a PDF document.

For a newly constructed object, if this function is not called to set this option, that means to use 256 as the default value of this option.

Parameters

  [in] | size | The size of tile, and this value can only be between 128 and 2048.

Note
  This method only valid in com.foxit.sdk.addon.optimization.ImageSettings.e_ImageCompressjpeg2000 compression mode.

Returns
  None.