c# resize image keep aspect ratio
C#
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));
}
Also in C#:
- Title
- unity change tag in script
- Category
- C#
- Title
- what is a protected int c#
- Category
- C#
- Title
- loops in coding
- Category
- C#
- Title
- unity load text resources from subfolder
- Category
- C#
- Title
- unity monobehaviour
- Category
- C#
- Title
- trello
- Category
- C#
- Title
- Update data in db .net
- Category
- C#
- Title
- how to spawn coins randomly around the screen unity 2d
- Category
- C#
- Title
- C# .net core convert int to enum
- Category
- C#
- Title
- c# remove character from string at index
- Category
- C#
- Title
- c# resize image keep aspect ratio
- Category
- C#
- Title
- c# switch statement
- Category
- C#
- Title
- wpf datatrigger enum binding
- Category
- C#
- Title
- c# arraylist to listview
- Category
- C#
- Title
- how to stop window from terminating c# visual studio
- Category
- C#
- Title
- c sharp if string equals
- Category
- C#
- Title
- c# window instantly close
- Category
- C#
- Title
- c# convert Unix time in seconds to datetime
- Category
- C#
- Title
- unity randomly generated numbers c#
- Category
- C#
- Title
- unity create gameobject
- Category
- C#
- Title
- what function is called just before the a script is ended c#
- Category
- C#
- Title
- what is the namespace for textmesh pro
- Category
- C#
- Title
- how to remove file changes in git
- Category
- C#
- Title
- c sharp add item to dictionary
- Category
- C#
- Title
- dynamically add rows to datagridview c#
- Category
- C#
- Title
- c# relaxed boolean cast
- Category
- C#
- Title
- start a particle effect when a button is pushed
- Category
- C#
- Title
- set int to null c#
- Category
- C#
- Title
- unity delete specific text in a string
- Category
- C#
- Title
- CS0103 C# The name 'Request.Url.Scheme' does not exist in the current context
- Category
- C#
- Title
- c# creating exceptions
- Category
- C#
- Title
- list with two values c#
- Category
- C#
- Title
- check version of asp.net core
- Category
- C#
- Title
- dynamic convert type c#
- Category
- C#
- Title
- unity oncollisionenter2d
- Category
- C#
- Title
- c# get current directory xamarin
- Category
- C#
- Title
- how to reference the position of a game object unity
- Category
- C#
- Title
- unity vector3 smoothdamp not reaching target
- Category
- C#
- Title
- how to stop player rotating when hit by object
- Category
- C#
- Title
- no overload for 'useItemOnSceneLoad' matches delegate 'UnityAction<Scene, LoadSceneMode>'
- Category
- C#
- Title
- c# convert list to string
- Category
- C#
- Title
- c# find duplicates in list of strings
- Category
- C#
- Title
- .net core session
- Category
- C#
- Title
- constructor in inherited class c#
- Category
- C#
- Title
- c# linq join multiple conditions
- Category
- C#
- Title
- asp net identity include phone number when registering
- Category
- C#
- Title
- snippet to create constructor in asp.net c#
- Category
- C#
- Title
- c# remove specific character from string
- Category
- C#
- Title
- if entity.is Transient() Update Mvc 5 c#
- Category
- C#
- Title
- c# zip a file
- Category
- C#
- Title
- c# list string return concatenate
- Category
- C#
- Title
- get enum value c#
- Category
- C#
- Title
- asp list box
- Category
- C#
- Title
- c# inotifypropertychanged best practices
- Category
- C#
- Title
- unity quaternion
- Category
- C#
- Title
- c# resize bitmap
- Category
- C#
- Title
- how to get value from object in c#
- Category
- C#
- Title
- iformfile blobclient
- Category
- C#
- Title
- how to cast list to observablecollection c#
- Category
- C#
- Title
- phone
- Category
- C#
- Title
- grab reference from method parameter c#
- Category
- C#
- Title
- how to delay something in c# unity
- Category
- C#
- Title
- assign datasource to dropdownlist in c#
- Category
- C#
- Title
- unity load scene
- Category
- C#
- Title
- c# get list of all class fields
- Category
- C#
- Title
- condition when a animation finishes in unity
- Category
- C#
- Title
- check for collision unity c#
- Category
- C#
- Title
- c# check internet connection easy
- Category
- C#
- Title
- c# md5 int
- Category
- C#
- Title
- add new page to site c# programmatically
- Category
- C#
- Title
- c sharp substring
- Category
- C#
- Title
- internal c#
- Category
- C#
- Title
- unity getcomponent
- Category
- C#
- Title
- c# making a folder
- Category
- C#
- Title
- debug.log unity
- Category
- C#
- Title
- how consider the first caracter in Split c#
- Category
- C#
- Title
- parsing string to int c#
- Category
- C#
- Title
- optional parameter get request c#
- Category
- C#
- Title
- how to turn a string in a char list c#
- Category
- C#
- Title
- C# previous method
- Category
- C#
- Title
- c# round number up
- Category
- C#
- Title
- devexpress objectspace to session
- Category
- C#
- Title
- Unity3d GPS code
- Category
- C#
- Title
- what is type unity
- Category
- C#
- Title
- unity find object by name
- Category
- C#
- Title
- c# convert byte to char
- Category
- C#
- Title
- unity c# get bool from another script
- Category
- C#
- Title
- calculate impact damage + unity
- Category
- C#
- Title
- bold caption latex
- Category
- C#
- Title
- c# loop through two dimensional array
- Category
- C#
- Title
- how do I attach a player with a navMeshAgent
- Category
- C#
- Title
- how to deactivate objects through scripts in unity
- Category
- C#
- Title
- unity serializefield
- Category
- C#
- Title
- roulette algorithm genetic algorithm
- Category
- C#
- Title
- No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.'
- Category
- C#
- Title
- value is null to insert in c#
- Category
- C#
- Title
- IEnumerator
- Category
- C#
- Title
- how to use K2 games Games parallax background
- Category
- C#
- Title
- c# create new object
- Category
- C#
- Title
- how to convert iformfile to byte array c#
- Category
- C#