Table of Contents

Interface IPdfImage

Namespace
UglyToad.PdfPig.Content
Assembly
UglyToad.PdfPig.dll

An image in a PDF document, may be an InlineImage or a PostScript image XObject (XObjectImage).

public interface IPdfImage

Properties

BitsPerComponent

The number of bits used to represent each color component.

int BitsPerComponent { get; }

Property Value

int

Bounds

The placement rectangle of the image in PDF coordinates.

PdfRectangle Bounds { get; }

Property Value

PdfRectangle

ColorSpaceDetails

The ColorSpaceDetails used to interpret the image.

This is not defined where IsImageMask is true and is optional where the image is JPXEncoded for XObjectImage.

ColorSpaceDetails ColorSpaceDetails { get; }

Property Value

ColorSpaceDetails

Decode

Describes how to map image samples into the values appropriate for the ColorSpace. The image data is initially composed of values in the range 0 to 2^n - 1 where n is BitsPerComponent. The decode array contains a pair of numbers for each component in the ColorSpace. The value from the image data is then interpolated into the values relevant to the ColorSpace using the corresponding values of the decode array.

IReadOnlyList<decimal> Decode { get; }

Property Value

IReadOnlyList<decimal>

HeightInSamples

The height of the image in samples.

int HeightInSamples { get; }

Property Value

int

ImageDictionary

The full dictionary for this image object.

DictionaryToken ImageDictionary { get; }

Property Value

DictionaryToken

Interpolate

Specifies whether interpolation is to be performed. Interpolation smooths images where a single component in the image as defined may correspond to many pixels on the output device. The interpolation algorithm is implementation dependent and is not defined by the specification.

bool Interpolate { get; }

Property Value

bool

IsImageMask

Indicates whether the image is to be treated as an image mask. If true the image is a monochrome image in which each sample is specified by a single bit (BitsPerComponent is 1). The image represents a stencil where sample values represent places on the page that should be marked with the current color or masked (not marked).

bool IsImageMask { get; }

Property Value

bool

IsInlineImage

Whether this image is an InlineImage or a XObjectImage.

bool IsInlineImage { get; }

Property Value

bool

RawBytes

The encoded bytes of the image with all filters still applied.

IReadOnlyList<byte> RawBytes { get; }

Property Value

IReadOnlyList<byte>

RenderingIntent

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

RenderingIntent RenderingIntent { get; }

Property Value

RenderingIntent

WidthInSamples

The width of the image in samples.

int WidthInSamples { get; }

Property Value

int

Methods

TryGetBytes(out IReadOnlyList<byte>)

Get the decoded bytes of the image if applicable. For JPEG images and some other types the RawBytes should be used directly.

bool TryGetBytes(out IReadOnlyList<byte> bytes)

Parameters

bytes IReadOnlyList<byte>

Returns

bool

TryGetPng(out byte[])

Try to convert the image to PNG. Doesn't support conversion of JPG to PNG.

bool TryGetPng(out byte[] bytes)

Parameters

bytes byte[]

Returns

bool