diff --git a/ShareX.HelpersLib/Enums.cs b/ShareX.HelpersLib/Enums.cs index 47600d855..7447ff036 100644 --- a/ShareX.HelpersLib/Enums.cs +++ b/ShareX.HelpersLib/Enums.cs @@ -167,14 +167,4 @@ public enum HotkeyStatus Failed, NotConfigured } - - public enum ResizeMode - { - [Description("Resizes all images to the specified size.")] - ResizeAll, - [Description("Only resize image if it is bigger than specified size.")] - ResizeIfBigger, - [Description("Only resize image if it is smaller than specified size.")] - ResizeIfSmaller - } } \ No newline at end of file diff --git a/ShareX.ImageEffectsLib/Enums.cs b/ShareX.ImageEffectsLib/Enums.cs index f2cb8d930..edd6c6e29 100644 --- a/ShareX.ImageEffectsLib/Enums.cs +++ b/ShareX.ImageEffectsLib/Enums.cs @@ -23,6 +23,8 @@ #endregion License Information (GPL v3) +using System.ComponentModel; + namespace ShareX.ImageEffectsLib { public enum WatermarkType @@ -30,4 +32,14 @@ public enum WatermarkType Text, Image } + + public enum ResizeMode + { + [Description("Resizes all images to the specified size.")] + ResizeAll, + [Description("Only resize image if it is bigger than specified size.")] + ResizeIfBigger, + [Description("Only resize image if it is smaller than specified size.")] + ResizeIfSmaller + } } \ No newline at end of file diff --git a/ShareX.ImageEffectsLib/Manipulations/Resize.cs b/ShareX.ImageEffectsLib/Manipulations/Resize.cs index 809d3cade..cac0929e1 100644 --- a/ShareX.ImageEffectsLib/Manipulations/Resize.cs +++ b/ShareX.ImageEffectsLib/Manipulations/Resize.cs @@ -37,8 +37,8 @@ public class Resize : ImageEffect [DefaultValue(0), Description("Use height as 0 to automatically adjust height to maintain aspect ratio.")] public int Height { get; set; } - [DefaultValue(ResizeMode.ResizeAll)] - public ResizeMode Mode { get; set; } + [DefaultValue(ResizeMode.ResizeAll)] + public ResizeMode Mode { get; set; } public Resize() { @@ -52,8 +52,11 @@ public override Image Apply(Image img) int width = Width <= 0 ? (int)((float)Height / img.Height * img.Width) : Width; int height = Height <= 0 ? (int)((float)Width / img.Width * img.Height) : Height; - if (Mode == ResizeMode.ResizeIfBigger && img.Width <= width && img.Height <= height) return img; - if (Mode == ResizeMode.ResizeIfSmaller && img.Width >= width && img.Height >= height) return img; + if ((Mode == ResizeMode.ResizeIfBigger && img.Width <= width && img.Height <= height) || + (Mode == ResizeMode.ResizeIfSmaller && img.Width >= width && img.Height >= height)) + { + return img; + } return ImageHelpers.ResizeImage(img, width, height); } diff --git a/ShareX/ImageTag.cs b/ShareX/ImageTag.cs index fd8907cb0..2161a0f1c 100644 --- a/ShareX/ImageTag.cs +++ b/ShareX/ImageTag.cs @@ -2,7 +2,7 @@ /* ShareX - A program that allows you to take screenshots and share any file type - Copyright (c) 2007-2016 ShareX Team + Copyright (c) 2007-2017 ShareX Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License