public static Size GetProportionateResize(this SizeL i, Size maxSize) { var ratioX = (double)maxSize.Width / i.Width; var ratioY = (double)maxSize.Height / i.Height; var ratio = Math.Min(ratioX, ratioY); var newWidth = (int)Math.Ceiling(i.Width * ratio); var newHeight = (int)(i.Height * ratio); return(new Size(newWidth, newHeight)); }
public static Image GetThumbnail(this Image i, SizeL maxSize) { return(GetThumbnail(i, maxSize.ToSize())); }
public static Size GetProportionateResize(this SizeL i, SizeL maxSize) { return(i.GetProportionateResize(maxSize.ToSize())); }
public SizeL(SizeL otherSize) { Width = otherSize.Width; Height = otherSize.Height; }