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, from which the image was decoded.

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

CloneFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata>)

Creates a new instance the metadata value associated with the specified key. The instance is created from a clone generated via GetFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata>).

public TFormatMetadata CloneFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata> key) where TFormatMetadata : class, IFormatMetadata<TFormatMetadata>

Parameters

key IImageFormat<TFormatMetadata>

The key of the value to get.

Returns

TFormatMetadata

The TFormatMetadata.

Type Parameters

TFormatMetadata

The type of metadata.

DeepClone()

Creates a new ImageMetadata that is a deep copy of the current instance.

public ImageMetadata DeepClone()

Returns

ImageMetadata

The ImageMetadata.

GetFormatMetadata<TFormatMetadata>(IImageFormat<TFormatMetadata>)

Gets the metadata value associated with the specified key.
If none is found, an instance is created either by conversion from the decoded image format metadata or the requested format default constructor. This instance will be added to the metadata for future requests.

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

Parameters

key IImageFormat<TFormatMetadata>

The key of the value to get.

Returns

TFormatMetadata

The TFormatMetadata.

Type Parameters

TFormatMetadata

The type of metadata.