Blog.Common.Utils.Helpers.ImageHelper.GetComputedImageSize C# (CSharp) Method

GetComputedImageSize() public method

public GetComputedImageSize ( int width, int height ) : Size
width int
height int
return System.Drawing.Size
        public Size GetComputedImageSize(int width, int height)
        {
            if (width > 400)
            {
                var divisor = Convert.ToDouble(width) / 400;
                var tHeight = Math.Round(Convert.ToDouble(height / divisor), 0, MidpointRounding.AwayFromZero);
                var size = new Size
                           {
                               Height = Convert.ToInt32(tHeight),
                               Width = 400
                           };

                return size;
            }

            return new Size(width, height);
        }