Table of Contents

Struct Resolution

Namespace
Egami.Metadata
Assembly
Egami.dll

Physical pixel density.

public readonly record struct Resolution : IEquatable<Resolution>
Implements
Inherited Members

Examples

RasterMetadata metadata = image.Metadata;
metadata.Text.Add(new TextEntry("Comment", "Made with Egami"));
metadata.Resolution = new Resolution(300, 300, ResolutionUnit.PerInch);
Console.WriteLine($"{metadata.ColorSpace}, ICC {metadata.IccProfile.Length} bytes, XMP {metadata.Xmp.Length} bytes");
foreach (EgamiDiagnostic warning in metadata.Warnings)
{
    Console.WriteLine($"Recovered from: {warning.Message} ({warning.Id})");
}

image.Save("duck-300dpi.png");

Constructors

Resolution(double, double, ResolutionUnit)

Physical pixel density.

public Resolution(double X, double Y, ResolutionUnit Unit)

Parameters

X double

Horizontal density.

Y double

Vertical density.

Unit ResolutionUnit

The unit of both values.

Examples

RasterMetadata metadata = image.Metadata;
metadata.Text.Add(new TextEntry("Comment", "Made with Egami"));
metadata.Resolution = new Resolution(300, 300, ResolutionUnit.PerInch);
Console.WriteLine($"{metadata.ColorSpace}, ICC {metadata.IccProfile.Length} bytes, XMP {metadata.Xmp.Length} bytes");
foreach (EgamiDiagnostic warning in metadata.Warnings)
{
    Console.WriteLine($"Recovered from: {warning.Message} ({warning.Id})");
}

image.Save("duck-300dpi.png");

Properties

Unit

The unit of both values.

public ResolutionUnit Unit { get; init; }

Property Value

ResolutionUnit

X

Horizontal density.

public double X { get; init; }

Property Value

double

Y

Vertical density.

public double Y { get; init; }

Property Value

double

Methods

ToPerInch()

Returns the same density in pixels per inch. A resolution with no unit is returned unchanged.

public Resolution ToPerInch()

Returns

Resolution

The density in pixels per inch.