diff --git a/src/ImageSharp/Common/Helpers/UnitConverter.cs b/src/ImageSharp/Common/Helpers/UnitConverter.cs
index 6bb9460e30..7ea64aa624 100644
--- a/src/ImageSharp/Common/Helpers/UnitConverter.cs
+++ b/src/ImageSharp/Common/Helpers/UnitConverter.cs
@@ -98,13 +98,14 @@ namespace SixLabors.ImageSharp.Common.Helpers
}
///
- /// Sets the exif profile resolution values.
+ /// Gets the exif profile resolution values.
///
/// The resolution unit.
/// The horizontal resolution value.
/// The vertical resolution value.
+ ///
[MethodImpl(InliningOptions.ShortMethod)]
- public static (ushort, double?, double?) AdjustToExif(PixelResolutionUnit unit, double horizontal, double vertical)
+ public static ExifResolutionValues GetExifResolutionValues(PixelResolutionUnit unit, double horizontal, double vertical)
{
switch (unit)
{
@@ -128,10 +129,10 @@ namespace SixLabors.ImageSharp.Common.Helpers
ushort exifUnit = (ushort)(unit + 1);
if (unit == PixelResolutionUnit.AspectRatio)
{
- return (exifUnit, null, null);
+ return new ExifResolutionValues(exifUnit, null, null);
}
- return (exifUnit, horizontal, vertical);
+ return new ExifResolutionValues(exifUnit, horizontal, vertical);
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs b/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs
index 1b042eec04..15694978fc 100644
--- a/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs
@@ -239,26 +239,26 @@ namespace SixLabors.ImageSharp.Formats.Tiff
private void ProcessResolution(ImageMetadata imageMetadata)
{
- (ushort, double?, double?) exifValues = UnitConverter.AdjustToExif(
+ ExifResolutionValues resolution = UnitConverter.GetExifResolutionValues(
imageMetadata.ResolutionUnits,
imageMetadata.HorizontalResolution,
imageMetadata.VerticalResolution);
this.Collector.AddOrReplace(new ExifShort(ExifTagValue.ResolutionUnit)
{
- Value = exifValues.Item1
+ Value = resolution.ResolutionUnit
});
- if (exifValues.Item2 != null && exifValues.Item3 != null)
+ if (resolution.VerticalResolution.HasValue && resolution.HorizontalResolution.HasValue)
{
this.Collector.AddOrReplace(new ExifRational(ExifTagValue.XResolution)
{
- Value = new Rational(exifValues.Item2.Value)
+ Value = new Rational(resolution.HorizontalResolution.Value)
});
this.Collector.AddOrReplace(new ExifRational(ExifTagValue.YResolution)
{
- Value = new Rational(exifValues.Item3.Value)
+ Value = new Rational(resolution.VerticalResolution.Value)
});
}
}