Table of Contents

Class PdfExtractedImage

Namespace
MiPdf.Images
Assembly
MiPdf.dll

An image found on a page or in an annotation appearance.

public sealed class PdfExtractedImage
Inheritance
PdfExtractedImage
Inherited Members

Properties

Bounds

Position on the page (default user space).

public PdfRectangle Bounds { get; }

Property Value

PdfRectangle

HasTransparency

True if the image has a soft mask or stencil mask (transparency).

public bool HasTransparency { get; }

Property Value

bool

Height

Height of the image in pixels (the /Height entry; 0 if missing).

public int Height { get; }

Property Value

int

IsJpeg

True for JPEG images (DCTDecode); GetEncodedData() returns a complete JPEG file.

public bool IsJpeg { get; }

Property Value

bool

IsJpeg2000

True for JPEG 2000 images; GetEncodedData() returns a JPEG 2000 file.

public bool IsJpeg2000 { get; }

Property Value

bool

Name

Resource name (null for inline images).

public string? Name { get; }

Property Value

string

Stream

The image XObject (or the expanded inline image).

public PdfStream Stream { get; }

Property Value

PdfStream

Transform

Transformation from the unit square to page coordinates.

public Matrix Transform { get; }

Property Value

Matrix

Width

Width of the image in pixels (the /Width entry; 0 if missing).

public int Width { get; }

Property Value

int

Methods

GetEncodedData()

The data with all non-image filters removed (for JPEG/JPEG 2000 the original file data).

public byte[] GetEncodedData()

Returns

byte[]

ToFile(out string)

Returns the image as a file: JPEG data for JPEG images without transparency, otherwise PNG (null if not decodable).

public byte[]? ToFile(out string extension)

Parameters

extension string

Returns

byte[]

ToPng(PdfColor?)

Decodes the image to PNG (with alpha channel from /SMask, /Mask or stencil masks). Returns null if the image cannot be decoded (JPEG, JPEG 2000, JBIG2, CCITT, Lab color) โ€“ use GetEncodedData() for JPEG.

public byte[]? ToPng(PdfColor? background = null)

Parameters

background PdfColor?

If set, transparency is composited onto this color (the PNG has no alpha channel).

Returns

byte[]

ToString()

Returns the resource name (or "inline"), the pixel size and the bounds, for debugging.

public override string ToString()

Returns

string