Show / Hide Table of Contents

Class Image

Image class provides common methods for working with PDF images.

Inheritance
System.Object
Image
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.dll
Syntax
public class Image : IDisposable
Remarks

PDF.Element contains a similar interface used to access image data. To create the Image object from image PDF.Element, pass the Element's SDF/Cos dictionary to Image constructor (i.e. Image image(element->GetXObject()) )

Constructors

Image(Obj)

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

Declaration
public Image(Obj image_xobject)
Parameters
Type Name Description
Obj image_xobject

the image_xobject

Remarks

To create the Image object from image PDF.Element, pass the Element's SDF/Cos dictionary to Image constructor (i.e. Image image(element->GetXObject()))

Methods

Create(SDFDoc, Filter)

Declaration
public static Image Create(SDFDoc doc, Filter stream)
Parameters
Type Name Description
SDFDoc doc
Filter stream
Returns
Type Description
Image

Create(SDFDoc, Filter, Obj)

Directly embed the image that is already compressed using the Image.InputFilter format. The function can be used to pass-through pre-compressed image data.

Declaration
public static Image Create(SDFDoc doc, Filter stream, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().

Filter stream
  • input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc.
Obj encoder_hints

The encoder hints

Returns
Type Description
Image

PDF.Image object representing the embedded image.

Remarks

if the input stream doesn't support Seek() operation the document will load whole data stream in memory before parsing.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, FilterReader, Int32, Int32, Int32, ColorSpace)

Create and embed an Image. Embed the raw image data taking into account specified compression hints.

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.

Declaration
public static Image Create(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
FilterReader 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
System.Int32 bpc
  • The number of bits used to represent each color component.
ColorSpace color_space
  • The color space in which image samples are represented.
Returns
Type Description
Image

PDF.Image object representing the embedded image.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, FilterReader, Int32, Int32, Int32, ColorSpace, Image.InputFilter)

Create and embed an Image. Embed the raw image data taking into account specified compression hints.

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.

Declaration
public static Image Create(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, Image.InputFilter input_format)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
FilterReader 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
System.Int32 bpc
  • The number of bits used to represent each color component.
ColorSpace color_space
  • The color space in which image samples are represented.
Image.InputFilter input_format
  • Image.InputFilter describing the format of pre-compressed image data.
Returns
Type Description
Image

PDF.Image object representing the embedded image.

Remarks

see the above method for details.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, FilterReader, Int32, Int32, Int32, ColorSpace, Obj)

Create and embed an Image. Embed the raw image data taking into account specified compression hints.

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.

Declaration
public static Image Create(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
FilterReader 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
System.Int32 bpc
  • The number of bits used to represent each color component.
ColorSpace color_space
  • The color space in which image samples are represented.
Obj encoder_hints

The encoder hints

Returns
Type Description
Image

PDF.Image object representing the embedded image.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, Byte[])

Declaration
public static Image Create(SDFDoc doc, byte[] image_data)
Parameters
Type Name Description
SDFDoc doc
System.Byte[] image_data
Returns
Type Description
Image

Create(SDFDoc, Byte[], Obj)

Directly embed the image that is already compressed using the Image.InputFilter format. The function can be used to pass-through pre-compressed image data.

Declaration
public static Image Create(SDFDoc doc, byte[] image_data, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().

System.Byte[] image_data

The stream or buffer containing compressed image data. The compression format must match the input_format parameter.

Obj encoder_hints

The encoder hints

Returns
Type Description
Image

PDF.Image object representing the embedded image.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, Byte[], Int32, Int32, Int32, ColorSpace)

Directly embed the image that is already compressed using the Image.InputFilter format. The function can be used to pass-through pre-compressed image data.

Declaration
public static Image Create(SDFDoc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().

System.Byte[] image_data

The stream or buffer containing compressed image data. The compression format must match the input_format parameter.

System.Int32 width

The width of the image, in samples.

System.Int32 height

The height of the image, in samples.

System.Int32 bpc

The number of bits used to represent each color component.

ColorSpace color_space

The color space in which image samples are specified.

Returns
Type Description
Image

PDF.Image object representing the embedded image.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, Byte[], Int32, Int32, Int32, ColorSpace, Image.InputFilter)

Directly embed the image that is already compressed using the Image.InputFilter format. The function can be used to pass-through pre-compressed image data.

Declaration
public static Image Create(SDFDoc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, Image.InputFilter input_format)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().

System.Byte[] image_data

The stream or buffer containing compressed image data. The compression format must match the input_format parameter.

System.Int32 width

The width of the image, in samples.

System.Int32 height

The height of the image, in samples.

System.Int32 bpc

The number of bits used to represent each color component.

ColorSpace color_space

The color space in which image samples are specified.

Image.InputFilter input_format

Image.InputFilter describing the format of pre-compressed image data.

Returns
Type Description
Image

PDF.Image object representing the embedded image.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, Byte[], Int32, Int32, Int32, ColorSpace, Obj)

Directly embed the image that is already compressed using the Image.InputFilter format. The function can be used to pass-through pre-compressed image data.

Declaration
public static Image Create(SDFDoc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().

System.Byte[] image_data

The stream or buffer containing compressed image data. The compression format must match the input_format parameter.

System.Int32 width

The width of the image, in samples.

System.Int32 height

The height of the image, in samples.

System.Int32 bpc

The number of bits used to represent each color component.

ColorSpace color_space

The color space in which image samples are specified.

Obj encoder_hints

The encoder hints

Returns
Type Description
Image

PDF.Image object representing the embedded image.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, Stream)

Declaration
public static Image Create(SDFDoc doc, Stream stream)
Parameters
Type Name Description
SDFDoc doc
System.IO.Stream stream
Returns
Type Description
Image

Create(SDFDoc, Stream, Obj)

Declaration
public static Image Create(SDFDoc doc, Stream stream, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc
System.IO.Stream stream
Obj encoder_hints
Returns
Type Description
Image

Create(SDFDoc, String)

Create and embed an Image from an external file.

Declaration
public static Image Create(SDFDoc doc, string filename)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. To obtain SDF.Doc from PDFDoc use PDFDoc.GetSDFDoc() or Obj.GetDoc().

System.String 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
Type Description
Image

PDF.Image object representing the embedded image.

Remarks

By default the function will either pass-through data preserving the original compression or will compress data using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, String, Obj)

Create and embed an Image from an external file taking into account specified compression hints.

Declaration
public static Image Create(SDFDoc doc, string filename, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. To obtain SDF.Doc from PDFDoc use PDFDoc.GetSDFDoc() or Obj.GetDoc().

System.String 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.

Obj encoder_hints

An optional SDF.Obj containing a hint (or an SDF.Array of hints) that could be used to select a specific compression method and compression parameters. 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("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.4 to 0.9. Increasing the threshold value will increase 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
Type Description
Image

PDF.Image object representing the embedded image.

Remarks

By default the function will either pass-through data preserving the original compression or will compress data using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateImageMask(SDFDoc, FilterReader, Int32, Int32)

Create and embed an ImageMask. Embed 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.

Declaration
public static Image CreateImageMask(SDFDoc doc, FilterReader image_data, int width, int height)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
FilterReader 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
Returns
Type Description
Image

PDF.Image object representing the embedded ImageMask.

Remarks

see Image.CreateImageMask for details.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateImageMask(SDFDoc, FilterReader, Int32, Int32, Obj)

Create and embed an ImageMask. Embed 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.

Declaration
public static Image CreateImageMask(SDFDoc doc, FilterReader image_data, int width, int height, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
FilterReader 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
Obj encoder_hints

The encoder hints

Returns
Type Description
Image

PDF.Image object representing the embedded ImageMask.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateImageMask(SDFDoc, Byte[], Int32, Int32)

Create and embed an ImageMask. Embed 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.

Declaration
public static Image CreateImageMask(SDFDoc doc, byte[] image_data, int width, int height)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
System.Byte[] 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
Returns
Type Description
Image

PDF.Image object representing the embedded ImageMask.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateImageMask(SDFDoc, Byte[], Int32, Int32, Obj)

Create and embed an ImageMask. Embed 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.

Declaration
public static Image CreateImageMask(SDFDoc doc, byte[] image_data, int width, int height, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
System.Byte[] 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
Obj encoder_hints

The encoder hints

Returns
Type Description
Image

PDF.Image object representing the embedded ImageMask.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateSoftMask(SDFDoc, FilterReader, Int32, Int32, Int32)

Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints.

Declaration
public static Image CreateSoftMask(SDFDoc doc, FilterReader image_data, int width, int height, int bpc)
Parameters
Type Name Description
SDFDoc doc
  • A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().
FilterReader 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).
System.Int32 width
  • The width of the image, in samples.
System.Int32 height
  • The height of the image, in samples.
System.Int32 bpc
  • The number of bits used to represent each color component.
Returns
Type Description
Image

the image

Remarks

this feature is available only in PDF 1.4 and higher.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateSoftMask(SDFDoc, FilterReader, Int32, Int32, Int32, Obj)

Creates the soft mask.

Declaration
public static Image CreateSoftMask(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc

the doc

FilterReader image_data

the image_data

System.Int32 width

the width

System.Int32 height

the height

System.Int32 bpc

the bpc

Obj encoder_hints

the encoder_hint

Returns
Type Description
Image

the image

Remarks

see Image.CreateSoftMask for details.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateSoftMask(SDFDoc, Byte[], Int32, Int32, Int32)

Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints.

Declaration
public static Image CreateSoftMask(SDFDoc doc, byte[] image_data, int width, int height, int bpc)
Parameters
Type Name Description
SDFDoc doc

the doc

System.Byte[] image_data

the image_data

System.Int32 width

the width

System.Int32 height

the height

System.Int32 bpc

the bpc

Returns
Type Description
Image

the image

Remarks

see Image.CreateSoftMask for details.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateSoftMask(SDFDoc, Byte[], Int32, Int32, Int32, Obj)

Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints.

Declaration
public static Image CreateSoftMask(SDFDoc doc, byte[] image_data, int width, int height, int bpc, Obj encoder_hints)
Parameters
Type Name Description
SDFDoc doc

A document to which the image should be added. The 'Doc' object can be obtained using Obj.GetDoc() or PDFDoc.GetSDFDoc().

System.Byte[] 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).

System.Int32 width

The width of the image, in samples.

System.Int32 height

The height of the image, in samples.

System.Int32 bpc

The number of bits used to represent each color component.

Obj encoder_hints

An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image.Create() for details.

Returns
Type Description
Image

the image

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Export(FilterWriter)

Saves this image to the output stream.

Declaration
public int Export(FilterWriter writer)
Parameters
Type Name Description
FilterWriter 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
Type Description
System.Int32

the number indicating the selected image format: (0 - PNG, 1 - TIF, 2 - JPEG).

Remarks

see the overloaded Image.Export method for more information.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Export(String)

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() or ExportAsPng().

Declaration
public int Export(string filename)
Parameters
Type Name Description
System.String 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
Type Description
System.Int32

the number indicating the selected image format: (0 - PNG, 1 - TIF, 2 - JPEG).

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ExportAsPng(FilterWriter)

Saves this image to a PNG output stream.

Declaration
public void ExportAsPng(FilterWriter writer)
Parameters
Type Name Description
FilterWriter writer

FilterWriter used to write to the output stream.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ExportAsPng(String)

Saves this image to a PNG file.

Declaration
public void ExportAsPng(string filename)
Parameters
Type Name Description
System.String filename

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

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ExportAsTiff(FilterWriter)

Saves this image to a TIFF output stream.

Declaration
public void ExportAsTiff(FilterWriter writer)
Parameters
Type Name Description
FilterWriter writer

FilterWriter used to write to the output stream.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ExportAsTiff(String)

Saves this image to a TIFF file.

Declaration
public void ExportAsTiff(string filename)
Parameters
Type Name Description
System.String filename

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

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Finalize()

Releases all resources used by the Image

Declaration
protected void Finalize()

GetBitsPerComponent()

Gets the bits per component.

Declaration
public int GetBitsPerComponent()
Returns
Type Description
System.Int32

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetComponentNum()

Gets the component number.

Declaration
public int GetComponentNum()
Returns
Type Description
System.Int32

the number of color components per sample.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetDecodeArray()

Gets the decode array.

Declaration
public Obj GetDecodeArray()
Returns
Type Description
Obj

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 Ref. Manual.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetImageColorSpace()

Gets the image color space.

Declaration
public ColorSpace GetImageColorSpace()
Returns
Type Description
ColorSpace

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetImageData()

Gets the image data.

Declaration
public Filter GetImageData()
Returns
Type Description
Filter

A stream (filter) containing decoded image data

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetImageDataSize()

Gets the image data size.

Declaration
public int GetImageDataSize()
Returns
Type Description
System.Int32

the size of image data in bytes

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetImageHeight()

Gets the image height.

Declaration
public int GetImageHeight()
Returns
Type Description
System.Int32

the height of the image, in samples.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetImageRenderingIntent()

Gets the image rendering intent.

Declaration
public GState.RenderingIntent GetImageRenderingIntent()
Returns
Type Description
GState.RenderingIntent

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

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetImageWidth()

Gets the image width.

Declaration
public int GetImageWidth()
Returns
Type Description
System.Int32

the width of the image, in samples.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetMask()

Gets the mask.

Declaration
public Obj GetMask()
Returns
Type Description
Obj

an image XObject defining an image mask to be applied to this image (See 'Explicit Masking', 4.8.5), 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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetSDFObj()

Gets the SDFObj.

Declaration
public Obj GetSDFObj()
Returns
Type Description
Obj

the underlying SDF/Cos object

GetSoftMask()

Gets the soft mask.

Declaration
public Obj GetSoftMask()
Returns
Type Description
Obj

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsImageInterpolate()

Checks if is image interpolate.

Declaration
public bool IsImageInterpolate()
Returns
Type Description
System.Boolean

a boolean indicating whether image interpolation is to be performed.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsImageMask()

Checks if is image mask.

Declaration
public bool IsImageMask()
Returns
Type Description
System.Boolean

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

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsValid()

Checks if is valid.

Declaration
public bool IsValid()
Returns
Type Description
System.Boolean

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

op_Assign(Image)

Assignment operator

Declaration
public Image op_Assign(Image r)
Parameters
Type Name Description
Image r

an given Image object

Returns
Type Description
Image

an Image object that equals to the given object

Set(Image)

Sets value to the given image value

Declaration
public void Set(Image p)
Parameters
Type Name Description
Image p

image object

SetMask(Image)

Set an Explicit Image Mask.

Declaration
public void SetMask(Image image_mask)
Parameters
Type Name Description
Image image_mask

the new mask

Remarks

image_mask must be a valid image mask (i.e. image_mask.IsImageMask() must return true.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetMask(Obj)

Set a Color Key Mask.

Declaration
public void SetMask(Obj mask)
Parameters
Type Name Description
Obj 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.

Remarks

the current document takes the ownership of the given SDF object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetSoftMask(Image)

Set a Soft Mask.

Declaration
public void SetSoftMask(Image soft_mask)
Parameters
Type Name Description
Image 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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Implements

System.IDisposable
Back to top Generated by DocFX