From 2d615259a0641159e9426b5c34417d515a469a40 Mon Sep 17 00:00:00 2001
From: asos-ruairicaldwell <60053464+ruairica@users.noreply.github.com>
Date: Fri, 15 Mar 2024 23:38:49 +0000
Subject: [PATCH] add orientation to MagickImageInfo
---
src/Magick.NET.Core/IMagickImageInfo.cs | 5 +++++
src/Magick.NET/MagickImageInfo.cs | 6 ++++++
.../MagickImageInfoTests/TheReadCollectionMethod.cs | 1 +
.../Magick.NET.Tests/MagickImageInfoTests/TheReadMethod.cs | 1 +
4 files changed, 13 insertions(+)
diff --git a/src/Magick.NET.Core/IMagickImageInfo.cs b/src/Magick.NET.Core/IMagickImageInfo.cs
index 37060da245..016c3da645 100644
--- a/src/Magick.NET.Core/IMagickImageInfo.cs
+++ b/src/Magick.NET.Core/IMagickImageInfo.cs
@@ -55,6 +55,11 @@ public partial interface IMagickImageInfo
///
int Width { get; }
+ ///
+ /// Gets the orientation of the image.
+ ///
+ OrientationType Orientation { get; }
+
///
/// Read basic information about an image.
///
diff --git a/src/Magick.NET/MagickImageInfo.cs b/src/Magick.NET/MagickImageInfo.cs
index 9bdacbdeb6..e9bca8407b 100644
--- a/src/Magick.NET/MagickImageInfo.cs
+++ b/src/Magick.NET/MagickImageInfo.cs
@@ -177,6 +177,11 @@ public MagickImageInfo(Stream stream, IMagickReadSettings? readSett
///
public int Width { get; private set; }
+ ///
+ /// Gets the orientation of the image.
+ ///
+ public OrientationType Orientation { get; private set; }
+
///
/// Read basic information about an image with multiple frames/pages.
///
@@ -439,5 +444,6 @@ private void Initialize(IMagickImage image)
Interlace = image.Interlace;
Quality = image.Quality;
Width = image.Width;
+ Orientation = image.Orientation;
}
}
diff --git a/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadCollectionMethod.cs b/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadCollectionMethod.cs
index e41fb4402e..586f3fc2f6 100644
--- a/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadCollectionMethod.cs
+++ b/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadCollectionMethod.cs
@@ -119,6 +119,7 @@ public void ShouldReturnTheCorrectInformation()
Assert.Equal(Interlace.NoInterlace, first.Interlace);
Assert.Equal(827, first.Width);
Assert.Equal(0, first.Quality);
+ Assert.Equal(OrientationType.TopLeft, first.Orientation);
}
}
diff --git a/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadMethod.cs b/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadMethod.cs
index fd4d52efa8..2973278651 100644
--- a/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadMethod.cs
+++ b/tests/Magick.NET.Tests/MagickImageInfoTests/TheReadMethod.cs
@@ -134,6 +134,7 @@ public void ShouldReturnTheCorrectInformation()
Assert.Equal(Interlace.NoInterlace, imageInfo.Interlace);
Assert.Equal(100, imageInfo.Quality);
Assert.Equal(123, imageInfo.Width);
+ Assert.Equal(OrientationType.Undefined, imageInfo.Orientation);
}
}