Table of Contents

Class ImageMetadata

Namespace
SixLabors.ImageSharp.Metadata
Assembly
SixLabors.ImageSharp.dll

Encapsulates the metadata of an image.

public sealed class ImageMetadata : IDeepCloneable<ImageMetadata>
Inheritance
ImageMetadata
Implements
Inherited Members
Extension Methods

Constructors

ImageMetadata()

Initializes a new instance of the ImageMetadata class.

public ImageMetadata()

Fields

DefaultHorizontalResolution

The default horizontal resolution value (dots per inch) in x direction. The default value is 96 PixelsPerInch.

public const double DefaultHorizontalResolution = 96

Field Value

double

DefaultPixelResolutionUnits

The default pixel resolution units. The default value is PixelsPerInch.

public const PixelResolutionUnit DefaultPixelResolutionUnits = PixelsPerInch

Field Value

PixelResolutionUnit

DefaultVerticalResolution

The default vertical resolution value (dots per inch) in y direction. The default value is 96 PixelsPerInch.

public const double DefaultVerticalResolution = 96

Field Value

double

Properties

CicpProfile

Gets or sets the CICP profile.

public CicpProfile? CicpProfile { get; set; }

Property Value

CicpProfile

DecodedImageFormat

Gets the original format, if any, the image was decode from.

public IImageFormat? DecodedImageFormat { get; }

Property Value

IImageFormat

ExifProfile

Gets or sets the Exif profile.

public ExifProfile? ExifProfile { get; set; }

Property Value

ExifProfile

HorizontalResolution

Gets or sets the resolution of the image in x- direction. It is defined as the number of dots per ResolutionUnits and should be an positive value.

public double HorizontalResolution { get; set; }

Property Value

double

The density of the image in x- direction.

IccProfile

Gets or sets the ICC profile.

public IccProfile? IccProfile { get; set; }

Property Value

IccProfile

IptcProfile

Gets or sets the IPTC profile.

public IptcProfile? IptcProfile { get; set; }

Property Value

IptcProfile

ResolutionUnits

Gets or sets unit of measure used when reporting resolution.

ValueUnit
AspectRatio (00)No units; width:height pixel aspect ratio = Ydensity:Xdensity
PixelsPerInch (01)Pixels per inch (2.54 cm)
PixelsPerCentimeter (02)Pixels per centimeter
PixelsPerMeter (03)Pixels per meter (100 cm)
public PixelResolutionUnit ResolutionUnits { get; set; }

Property Value

PixelResolutionUnit

VerticalResolution

Gets or sets the resolution of the image in y- direction. It is defined as the number of dots per ResolutionUnits and should be an positive value.

public double VerticalResolution { get; set; }

Property Value

double

The density of the image in y- direction.

XmpProfile

Gets or sets the XMP profile.

public XmpProfile? XmpProfile { get; set; }

Property Value

XmpProfile

Methods

DeepClone()

public ImageMetadata DeepClone()

Returns

ImageMetadata

GetFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata>)

Gets the metadata value associated with the specified key.

public TFormatMetadata GetFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata> key) where TFormatMetadata : class, IDeepCloneable

Parameters

key IImageFormat<TFormatMetadata>

The key of the value to get.

Returns

TFormatMetadata

The TFormatMetadata.

Type Parameters

TFormatMetadata

The type of metadata.

TryGetFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata>, out TFormatMetadata?)

Gets the metadata value associated with the specified key.

public bool TryGetFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata> key, out TFormatMetadata? metadata) where TFormatMetadata : class, IDeepCloneable

Parameters

key IImageFormat<TFormatMetadata>

The key of the value to get.

metadata TFormatMetadata

When this method returns, contains the metadata associated with the specified key, if the key is found; otherwise, the default value for the type of the metadata parameter. This parameter is passed uninitialized.

Returns

bool

true if the frame metadata exists for the specified key; otherwise, false.

Type Parameters

TFormatMetadata

The type of format metadata.