Summary: Nested Classes | Constants | Ctors | Methods | Inherited Methods | [Expand All]
public class

# Image

extends Object

java.lang.Object
↳ | com.pdftron.pdf.Image

## Class Overview

Image class that provides common methods for working with PDF images.

Note: `Element` contains a similar interface used to access image data. To create the Image object from image `Element`, pass the Element's SDF/Cos dictionary to Image constructor like the example below:

`Image image = new Image(element.getXObject());`

## Summary

Nested Classes
class | Image.Compat | Compatibility layer for older API.

Constants
int | e_ascii_hex | InputFilter format: Input image stream compressed using ASCIIHexDecode filter.
int | e_flate | InputFilter format: Input image is a Flate compressed.
int | e_g3 | InputFilter format: Input image is a G3 stream.
int | e_g4 | InputFilter format: Input image is a G4 stream.
int | e_jp2 | InputFilter format: Input image is a JP2 (JPEG2000) image.
int | e_jpeg | InputFilter format: Input image is a JPEG image.
int | e_none | InputFilter format: Input stream is not compressed.

Public Constructors
| Image(Obj image_xobject) Creates an image from an existing image represented as a SDF/Cos object.

Public Methods
long | __GetHandle()
static Image | create(Doc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, int input_format) Embeds the raw image data taking into account specified compression hints.
static Image | create(Doc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space) Creates and embeds an Image.
static Image | create(Doc doc, byte[] image_data, Obj encoder_hint) Create an embed Image from buffer
static Image | create(Doc doc, Filter stream, Obj encoder_hint) Create an embed Image from buffer Note: PDFNet takes ownership of the filter stream and it should not be accessed after calling this method.
static Image | create(Doc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space) Creates and embeds an Image from a buffer.
static Image | create(Doc doc, String filename, Obj encoder_hint) Creates and embeds an Image from an external file.
static Image | create(Doc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hint) Creates an embeds an Image.
static Image | create(Doc doc, byte[] image_data) Create an embed Image from buffer
static Image | create(Doc doc, String filename) Creates and embeds an Image from an external file.
static Image | create(Doc doc, Image bmp) Creates an embeded image from an Image object
static Image | create(Doc doc, Filter stream) Create an embed Image from buffer Note: PDFNet takes ownership of the filter stream and it should not be accessed after calling this method.
static Image | create(Doc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hint) Creates and embeds an Image from a buffer taking into account specified compression hints.
static Image | create(Doc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, int input_format) Directly embeds the image that is already compressed using the input filter format.
static Image | createImageMask(Doc doc, byte[] image_data, int width, int height, Obj encoder_hint) Creates and embeds an ImageMask from a buffer.
static Image | createImageMask(Doc doc, FilterReader image_data, int width, int height) Creates and embeds an ImageMask.
static Image | createImageMask(Doc doc, FilterReader image_data, int width, int height, Obj encoder_hint) Creates and embeds an ImageMask.
static Image | createImageMask(Doc doc, byte[] image_data, int width, int height) Creates and embeds an ImageMask.
static Image | createSoftMask(Doc doc, FilterReader image_data, int width, int height, int bpc, Obj encoder_hint) Creates and embeds a Soft Mask.
static Image | createSoftMask(Doc doc, FilterReader image_data, int width, int height, int bpc) Creates and embeds a Soft Mask.
static Image | createSoftMask(Doc doc, byte[] image_data, int width, int height, int bpc) Creates and embeds a Soft Mask.
static Image | createSoftMask(Doc doc, byte[] image_data, int width, int height, int bpc, Obj encoder_hint) Creates and embeds a Soft Mask.
int | export(String filename) Saves this image to a file.
int | export(FilterWriter writer) Saves this image to the output stream.
void | exportAsPng(FilterWriter writer) Saves this image to a PNG output stream.
void | exportAsPng(String filename) Saves this image to a PNG file.
void | exportAsTiff(String filename) Saves this image to a TIFF file.
void | exportAsTiff(FilterWriter writer) Saves this image to a TIFF output stream.
Image | getBitmap() Gets the bitmap of the current image.
int | getBitsPerComponent() Gets the bits per component.
int | getComponentNum() Gets the component number
Obj | getDecodeArray() Gets the decode array.
ColorSpace | getImageColorSpace() Gets the image color space.
Filter | getImageData() Gets the image data as filter.
int | getImageDataSize() Gets the image data size.
int | getImageHeight() Gets the image height.
int | getImageRenderingIntent() Gets the current image rendering intent.
int | getImageWidth() Gets the image width.
Obj | getMask() Gets the mask from current image.
Obj | getSDFObj() Gets the SDFObj.
Obj | getSoftMask() Gets the soft mask from current image.
boolean | isImageInterpolate() Checks if current image is image interpolate.
boolean | isImageMask() Checks if current image is image mask.
boolean | isValid() Checks if current image is valid.
void | setMask(Image image_mask) Sets an Explicit Image Mask.
void | setMask(Obj mask) Sets a Color Key Mask.
void | setSoftMask(Image soft_mask) Sets a Soft Mask from current image.

[Expand] Inherited Methods
From class java.lang.Object
boolean | equals(Object arg0)
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Constants

#### public static final int e_ascii_hex

InputFilter format: Input image stream compressed using ASCIIHexDecode filter.

Constant Value: 6 (0x00000006)

#### public static final int e_flate

InputFilter format: Input image is a Flate compressed.

Constant Value: 3 (0x00000003)

#### public static final int e_g3

InputFilter format: Input image is a G3 stream.

Constant Value: 4 (0x00000004)

#### public static final int e_g4

InputFilter format: Input image is a G4 stream.

Constant Value: 5 (0x00000005)

#### public static final int e_jp2

InputFilter format: Input image is a JP2 (JPEG2000) image.

Constant Value: 2 (0x00000002)

#### public static final int e_jpeg

InputFilter format: Input image is a JPEG image.

Constant Value: 1 (0x00000001)

#### public static final int e_none

InputFilter format: Input stream is not compressed.

Constant Value: 0 (0x00000000)

## Public Constructors

#### public Image (Obj image_xobject)

Creates an image from an existing image represented as a SDF/Cos object.

Note: To create the Image object from image `Element`, pass the Element's SDF/Cos dictionary to Image constructor like the example below:

`Image image = new Image(element.getXObject());`

##### Parameters

image_xobject | the image_xobject

## Public Methods

#### public long __GetHandle ()

#### public static Image create (Doc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, int input_format)

Embeds the raw image data taking into account specified compression hints.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The image buffer as a Filter.
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
color_space | The color space in which image samples are specified.
input_format | Input filter describing the format of pre-compressed image data.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space)

Creates and embeds an Image.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
color_space | The color space in which image samples are represented.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, byte[] image_data, Obj encoder_hint)

Create an embed Image from buffer

##### Parameters

doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc().
image_data | - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
encoder_hint | a parameter to fine tune compression or to select a different compression algorithm

##### Returns

- PDF.Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, Filter stream, Obj encoder_hint)

Create an embed Image from buffer

Note: PDFNet takes ownership of the filter stream and it should not be accessed after calling this method.

##### Parameters

doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc().
stream | - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
encoder_hint | a parameter to fine tune compression or to select a different compression algorithm

##### Returns

- PDF.Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space)

Creates and embeds an Image from a buffer. By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
color_space | The color space in which image samples are represented.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, String filename, Obj encoder_hint)

Creates and embeds an Image from an external file.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
filename | The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm. For a concrete example of how to create encoder hints, please take a look at JBIG2Test and AddImage sample projects. The image encoder accepts the following hints: - /JBIG2; SDF.Name(e_JBIG2), An SDF Name Object with value equal to "JBIG2". If the image is monochrome (i.e. bpc == 1), the encoder will compress the image using JBIG2Decode filter. Note that JBIG2 compression is not recommended for use on scanned text/financial documents or equivalent since its lossless nature can lead to similar looking numbers or characters being replaced. - [/JBIG2 /Threshold 0.6 /SharePages 50] - Compress a monochrome image using lossy JBIG2Decode compression with the given image threshold and by sharing segments from a specified number of pages. The threshold is a floating point number in the rage from 0 to 1. Increasing the threshold value will decrease the loss of image quality, but may increase the file size. The default value for threshold is 0.85. "SharePages" parameter can be used to specify the maximum number of pages sharing a common 'JBIG2Globals' segment stream. Increasing the value of this parameter improves compression ratio at the expense of memory usage. - [/CCITT] - Compress a monochrome (i.e. bpc == 1) image using CCITT Group 4 compression. This algorithm typically produces larger output than JBIG2, but is lossless. This makes it much more suitable for scanned text documents. CCITT is the best option for more general monochrome compression use cases, since JBIG2 has potential to change image content. - [/JPEG] - Use JPEG compression with default compression. - [/JPEG /Quality 60] - Use JPEG compression with given quality setting. The "Quality" value is expressed on the 0..100 scale. - [/JPEG2000] - Use JPEG2000 compression to compress a RGB or a grayscale image. - [/JP2] - Use JPEG2000 compression with JP2 encoding. JP2 does not support CMYK images. - [/Flate] - Use Flate compression with maximum compression at the expense of speed. - [/Flate /Level 9] - Use Flate compression using specified compression level. Compression "Level" must be a number between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). - /RAW or [/RAW] - The encoder will not use any compression method and the image will be stored in the raw format.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hint)

Creates an embeds an Image.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
color_space | The color space in which image samples are represented.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, byte[] image_data)

Create an embed Image from buffer

##### Parameters

doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc().
image_data | - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).

##### Returns

- PDF.Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, String filename)

Creates and embeds an Image from an external file.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
filename | The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF. Other raster formats can be embedded by decompressing image data and using other versions of Image.Create(...) method.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, Image bmp)

Creates an embeded image from an Image object

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
bmp | the image to be added

##### Returns

- the embeded image

##### Throws

| PDFNetException
InterruptedException |
PDFNetException |

#### public static Image create (Doc doc, Filter stream)

Create an embed Image from buffer

Note: PDFNet takes ownership of the filter stream and it should not be accessed after calling this method.

##### Parameters

doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc().
stream | - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).

##### Returns

- PDF.Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hint)

Creates and embeds an Image from a buffer taking into account specified compression hints.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
color_space | The color space in which image samples are represented.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image create (Doc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, int input_format)

Directly embeds the image that is already compressed using the input filter format. The function can be used to pass-through pre-compressed image data.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing compressed image data. The compression format must match the input_format parameter.
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
color_space | The color space in which image samples are specified.
input_format | Input filter describing the format of pre-compressed image data.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image createImageMask (Doc doc, byte[] image_data, int width, int height, Obj encoder_hint)

Creates and embeds an ImageMask from a buffer.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data.
width | The width of the image, in samples.
height | The height of the image, in samples.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm.

##### Returns

- Image object representing the embedded image.

##### Throws

PDFNetException |

#### public static Image createImageMask (Doc doc, FilterReader image_data, int width, int height)

Creates and embeds an ImageMask.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data.
width | The width of the image, in samples.
height | The height of the image, in samples.

##### Returns

- Image object representing the created image mask.

##### Throws

PDFNetException |

#### public static Image createImageMask (Doc doc, FilterReader image_data, int width, int height, Obj encoder_hint)

Creates and embeds an ImageMask.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data.
width | The width of the image, in samples.
height | The height of the image, in samples.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm.

##### Returns

- Image object representing the created image mask.

##### Throws

PDFNetException |

#### public static Image createImageMask (Doc doc, byte[] image_data, int width, int height)

Creates and embeds an ImageMask. Embeds the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data stored in 1 bit per sample format. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
width | The width of the image, in samples.
height | The height of the image, in samples.

##### Returns

- Image object representing the embedded ImageMask.

##### Throws

PDFNetException |

#### public static Image createSoftMask (Doc doc, FilterReader image_data, int width, int height, int bpc, Obj encoder_hint)

Creates and embeds a Soft Mask.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The image buffer as a Filter.
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm.

##### Returns

- The created image soft mask.

##### Throws

PDFNetException |

#### public static Image createSoftMask (Doc doc, FilterReader image_data, int width, int height, int bpc)

Creates and embeds a Soft Mask. Embeds the raw image data taking into account specified compression hints.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The image buffer as a Filter.
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.

##### Returns

- The created image soft mask.

##### Throws

PDFNetException |

#### public static Image createSoftMask (Doc doc, byte[] image_data, int width, int height, int bpc)

Creates and embeds a Soft Mask. Embeds the raw image data taking into account specified compression hints.

Note: This feature is available only in PDF 1.4 and higher.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data represented in DeviceGray color space (i.e. one component per sample). The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details).
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.

##### Returns

- The created image soft mask.

##### Throws

PDFNetException |

#### public static Image createSoftMask (Doc doc, byte[] image_data, int width, int height, int bpc, Obj encoder_hint)

Creates and embeds a Soft Mask.

##### Parameters

doc | A document to which the image should be added. The 'Doc' object can be obtained using `getDoc()` or `getSDFDoc()`.
image_data | The stream or buffer containing image data.
width | The width of the image, in samples.
height | The height of the image, in samples.
bpc | The number of bits used to represent each color component.
encoder_hint | A parameter to fine tune compression or to select a different compression algorithm.

##### Returns

- The created image soft mask.

##### Throws

PDFNetException |

#### public int export (String filename)

Saves this image to a file.

The output image format (TIFF, JPEG, or PNG) will be automatically selected based on the properties of the embedded image. For example, if the embedded image is using CCITT Fax compression, the output format will be TIFF. Similarly, if the embedded image is using JPEG compression the output format will be JPEG. If your application needs to explicitly control output image format you may want to use `exportAsTiff(String)` or `exportAsPng(String)`.

##### Parameters

filename | String that specifies the path name for the saved image. The filename should not include the extension which will be appended to the filename string based on the output format.

##### Returns

- the number indicating the selected image format:
  - 0 - PNG
  - 1 - TIF
  - 2 - JPEG

##### Throws

PDFNetException |

#### public int export (FilterWriter writer)

Saves this image to the output stream.

##### Parameters

writer | A pointer to FilterWriter used to write to the output stream. If the parameter is `null`, nothing will be written to the output stream, but the function returns the format identifier.

##### Returns

- the number indicating the selected image format:
  - 0 - PNG
  - 1 - TIF
  - 2 - JPEG

##### Throws

| PDFNetException
PDFNetException |

##### See Also

- `export(String)`

#### public void exportAsPng (FilterWriter writer)

Saves this image to a PNG output stream.

##### Parameters

writer | FilterWriter used to write to the output stream.

##### Throws

PDFNetException |

#### public void exportAsPng (String filename)

Saves this image to a PNG file.

##### Parameters

filename | String that specifies the path name for the saved image. The filename should include the file extension.

##### Throws

PDFNetException |

#### public void exportAsTiff (String filename)

Saves this image to a TIFF file.

##### Parameters

filename | String that specifies the path name for the saved image. The filename should include the file extension.

##### Throws

PDFNetException |

#### public void exportAsTiff (FilterWriter writer)

Saves this image to a TIFF output stream.

##### Parameters

writer | FilterWriter used to write to the output stream.

##### Throws

PDFNetException |

#### public Image getBitmap ()

Gets the bitmap of the current image.

##### Returns

- the bitmap of the current image

##### Throws

PDFNetException |

#### public int getBitsPerComponent ()

Gets the bits per component.

##### Returns

- the number of bits used to represent each color component. Only a single value may be specified; the number of bits is the same for all color components. Valid values are 1, 2, 4, 8, and 16.

##### Throws

PDFNetException |

#### public int getComponentNum ()

Gets the component number

##### Returns

- the number of color components per sample

##### Throws

PDFNetException |

#### public Obj getDecodeArray ()

Gets the decode array.

##### Returns

- Decode array or `null` if the paramter is not specified. A decode object is an array of numbers describing how to map image samples into the range of values appropriate for the images color space. If ImageMask is true, the array must be either [0 1] or [1 0]; otherwise, its length must be twice the number of color components required by ColorSpace. Default value depends on the color space, See Table 4.36 in PDF Reference Manual.

##### Throws

PDFNetException |

#### public ColorSpace getImageColorSpace ()

Gets the image color space.

##### Returns

- The SDF object representing the color space in which image samples are specified or `null` if:
  - the image is an image mask
  - or is compressed using JPXDecode with missing ColorSpace entry in image dictionary.
  The returned color space may be any type of color space except Pattern.

##### Throws

PDFNetException |

#### public Filter getImageData ()

Gets the image data as filter.

##### Returns

- A stream (filter) containing decoded image data.

##### Throws

PDFNetException |

#### public int getImageDataSize ()

Gets the image data size.

##### Returns

- the size of image data in bytes

##### Throws

PDFNetException |

#### public int getImageHeight ()

Gets the image height.

##### Returns

- The height of the image, in samples.

##### Throws

PDFNetException |

#### public int getImageRenderingIntent ()

Gets the current image rendering intent.

##### Returns

- The color rendering intent to be used in rendering the image.

##### Throws

PDFNetException |

#### public int getImageWidth ()

Gets the image width.

##### Returns

- The width of the image, in samples.

##### Throws

PDFNetException |

#### public Obj getMask ()

Gets the mask from current image.

##### Returns

- An image XObject defining an image mask to be applied to this image (See 'Explicit Masking', 4.8.5 of the PDF Reference Manual), or an array specifying a range of colors to be applied to it as a color key mask (See 'Color Key Masking').

  If `isImageMask()` return `true`, this method will return `null`.

##### Throws

PDFNetException |

#### public Obj getSDFObj ()

Gets the SDFObj.

##### Returns

- the underlying SDF/Cos object

#### public Obj getSoftMask ()

Gets the soft mask from current image.

##### Returns

- an image XObject defining a Soft Mask to be applied to this image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual), or `null` if the image does not have the soft mask.

##### Throws

PDFNetException |

#### public boolean isImageInterpolate ()

Checks if current image is image interpolate.

##### Returns

- a boolean indicating whether image interpolation is to be performed

##### Throws

PDFNetException |

#### public boolean isImageMask ()

Checks if current image is image mask.

##### Returns

- a boolean indicating whether the inline image is to be treated as an image mask

##### Throws

PDFNetException |

#### public boolean isValid ()

Checks if current image is valid.

##### Returns

- whether this is a valid raster image. If the function returns false the underlying SDF/Cos object is not a valid raster image and this Image object should be treated as `null`.

##### Throws

PDFNetException |

#### public void setMask (Image image_mask)

Sets an Explicit Image Mask.

Note: `image_mask` must be a valid image mask (i.e. image_mask.isImageMask() must return `true`).

##### Parameters

image_mask | the new mask

##### Throws

PDFNetException |

#### public void setMask (Obj mask)

Sets a Color Key Mask.

Note: The current document takes the ownership of the given SDF object.

##### Parameters

mask | is an Cos/SDF array specifying a range of colors to be masked out. Samples in the image that fall within this range are not painted, allowing the existing background to show through. The effect is similar to that of the video technique known as chroma-key. For details of the array format please refer to section 4.8.5 'Color Key Masking' in PDF Reference Manual.

##### Throws

PDFNetException |

#### public void setSoftMask (Image soft_mask)

Sets a Soft Mask from current image.

##### Parameters

soft_mask | is a subsidiary Image object defining a soft-mask image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual) to be used as a source of mask shape or mask opacity values in the transparent imaging model. The alpha source parameter in the graphics state determines whether the mask values are interpreted as shape or opacity.

##### Throws

PDFNetException |