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

NameTypeAccessDescription
NamestringReadThe resource name (e.g., “Im0”).
WidthintReadImage width in pixels.
HeightintReadImage height in pixels.
BitsPerComponentintReadBits per component.
ColorSpacestring?ReadColor space name.
Filterstring?ReadThe filter used (e.g., “DCTDecode” for JPEG, “FlateDecode”).
IsJpegboolReadWhether this is a JPEG image (DCTDecode filter).
IsJpeg2000boolReadWhether this is a JPEG2000 image (JPXDecode filter).
HasSoftMaskboolReadWhether this image has a soft mask (alpha channel).
IsImageMaskboolReadWhether this is an image mask (stencil).
ComponentCountintReadNumber of color components based on the color space.

Methods

SignatureDescription
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.

See Also