ImageXObject
Overview
ImageXObject is a class in Aspose.PDF FOSS for .NET.
Represents an image XObject found in a PDF page’s resources.
This class provides 7 methods for working with ImageXObject objects in .NET programs.
Available methods include: GetDecodedData, GetJpegBytes, GetRawData, Save, ToPng.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: BitsPerComponent, ColorSpace, ComponentCount, Filter, HasSoftMask, Height, and 5 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Name | string | Read | The resource name (e.g., “Im0”). |
Width | int | Read | Image width in pixels. |
Height | int | Read | Image height in pixels. |
BitsPerComponent | int | Read | Bits per component. |
ColorSpace | string? | Read | Color space name. |
Filter | string? | Read | The filter used (e.g., “DCTDecode” for JPEG, “FlateDecode”). |
IsJpeg | bool | Read | Whether this is a JPEG image (DCTDecode filter). |
IsJpeg2000 | bool | Read | Whether this is a JPEG2000 image (JPXDecode filter). |
HasSoftMask | bool | Read | Whether this image has a soft mask (alpha channel). |
IsImageMask | bool | Read | Whether this is an image mask (stencil). |
ComponentCount | int | Read | Number of color components based on the color space. |
Methods
| Signature | Description |
|---|---|
GetRawData() | Get the raw (encoded) image data. |
GetDecodedData() | Get the decoded image data (filters removed). |
GetJpegBytes() | For JPEG images, returns the raw JPEG bytes (ready to write as .jpg file). |
Save(output: Stream) | Save the image to a stream. |
Save(output: Stream, format: System.Drawing.Imaging.ImageFormat) | Save the image to a stream in the specified format. |
Save(path: string) | Save the image to a file. |
ToPng() | Export the image as PNG bytes. |