Horje
c# resize image keep aspect ratio Code Example
c# resize image keep aspect ratio
using System.Drawing;
public static Size ResizeKeepAspect(this Size src, int maxWidth, int maxHeight, bool enlarge = false)
{
    maxWidth = enlarge ? maxWidth : Math.Min(maxWidth, src.Width);
    maxHeight = enlarge ? maxHeight : Math.Min(maxHeight, src.Height);

    decimal rnd = Math.Min(maxWidth / (decimal)src.Width, maxHeight / (decimal)src.Height);
    return new Size((int)Math.Round(src.Width * rnd), (int)Math.Round(src.Height * rnd));
}




Csharp

Related
how to make a method wait in unity Code Example how to make a method wait in unity Code Example
unity smooth rotation 2d Code Example unity smooth rotation 2d Code Example
c# if debug Code Example c# if debug Code Example
c# check if string is empty Code Example c# check if string is empty Code Example
In Asp.Net Core core how to I get the web site's IP address? Code Example In Asp.Net Core core how to I get the web site's IP address? Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
14