Table of Contents

Class ImageInfo

Namespace
SixLabors.ImageSharp
Assembly
SixLabors.ImageSharp.dll

Contains information about the image including dimensions, pixel type information and additional metadata

public class ImageInfo
Inheritance
ImageInfo
Inherited Members

Constructors

ImageInfo(Size, ImageMetadata)

Initializes a new instance of the ImageInfo class.

public ImageInfo(Size size, ImageMetadata metadata)

Parameters

size Size

The size of the image in px units.

metadata ImageMetadata

The image metadata.

ImageInfo(Size, ImageMetadata, IReadOnlyList<ImageFrameMetadata>?)

Initializes a new instance of the ImageInfo class.

public ImageInfo(Size size, ImageMetadata metadata, IReadOnlyList<ImageFrameMetadata>? frameMetadataCollection)

Parameters

size Size

The size of the image in px units.

metadata ImageMetadata

The image metadata.

frameMetadataCollection IReadOnlyList<ImageFrameMetadata>

The collection of image frame metadata.

Properties

Bounds

Gets the bounds of the image.

public Rectangle Bounds { get; }

Property Value

Rectangle

FrameCount

Gets the number of frame metadata entries available for the image.

public int FrameCount { get; }

Property Value

int

Remarks

This value is the same as FrameMetadataCollection count and may be 0 when frame metadata was not populated by the decoder.

FrameMetadataCollection

Gets the metadata associated with the decoded image frames, if available.

public IReadOnlyList<ImageFrameMetadata> FrameMetadataCollection { get; }

Property Value

IReadOnlyList<ImageFrameMetadata>

Remarks

For multi-frame formats, decoders populate one entry per decoded frame. For single-frame formats, this collection is typically empty.

Height

Gets the image height in px units.

public int Height { get; }

Property Value

int

Metadata

Gets any metadata associated with the image.

public ImageMetadata Metadata { get; }

Property Value

ImageMetadata

PixelType

Gets information about the image pixels.

public PixelTypeInfo PixelType { get; }

Property Value

PixelTypeInfo

Size

Gets the size of the image in px units.

public Size Size { get; }

Property Value

Size

Width

Gets the image width in px units.

public int Width { get; }

Property Value

int

Methods

GetPixelMemorySize()

Gets the total number of bytes required to store the image pixels in memory.

public long GetPixelMemorySize()

Returns

long

The total number of bytes required to store the image pixels in memory.

Remarks

This reports the in-memory size of the pixel data represented by this ImageInfo, not the encoded size of the image file. The value is computed from the image dimensions and PixelType. When FrameMetadataCollection contains decoded frame metadata, the per-frame size is multiplied by that count. Otherwise, the value is the in-memory size of the single image frame represented by this ImageInfo.