diff --git a/Quaver.API/Maps/AutoMod/AutoMod.cs b/Quaver.API/Maps/AutoMod/AutoMod.cs index ff418224e..703720613 100644 --- a/Quaver.API/Maps/AutoMod/AutoMod.cs +++ b/Quaver.API/Maps/AutoMod/AutoMod.cs @@ -19,7 +19,7 @@ using Quaver.API.Maps.Structures; using Quaver.API.Replays; using Quaver.API.Replays.Virtual; -using SixLabors.ImageSharp; +using SkiaSharp; namespace Quaver.API.Maps.AutoMod { @@ -445,15 +445,33 @@ private void DetectImageFileIssues(string item, string path, int maxSize, int mi if (new FileInfo(path).Length > maxSize) Issues.Add(new AutoModIssueImageTooLarge(item, maxSize)); + if (!TryGetImageDimensions(path, out var width, out var height)) + return; + + if (width < minWidth || height < minHeight || width > maxWidth || height > maxHeight) + Issues.Add(new AutoModIssueImageResolution(item, minWidth, minHeight, maxWidth, maxHeight)); + } + + private static bool TryGetImageDimensions(string path, out int width, out int height) + { + width = 0; + height = 0; + try { - using (var image = Image.Load(path)) - if (image.Width < minWidth || image.Height < minHeight || image.Width > maxWidth || image.Height > maxHeight) - Issues.Add(new AutoModIssueImageResolution(item, minWidth, minHeight, maxWidth, maxHeight)); + using (var codec = SKCodec.Create(path)) + { + if (codec == null) + return false; + + width = codec.Info.Width; + height = codec.Info.Height; + return width > 0 && height > 0; + } } catch (Exception) { - // ignored + return false; } } diff --git a/Quaver.API/Quaver.API.csproj b/Quaver.API/Quaver.API.csproj index 98668be6a..0ae48467d 100644 --- a/Quaver.API/Quaver.API.csproj +++ b/Quaver.API/Quaver.API.csproj @@ -12,7 +12,8 @@ - + +