Struct Resolution
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
XdoubleHorizontal density.
YdoubleVertical density.
UnitResolutionUnitThe 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
X
Horizontal density.
public double X { get; init; }
Property Value
Y
Vertical density.
public double Y { get; init; }
Property Value
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.