This documentation is for the old version. Go to the latest Graphics Mill docs

Resize.CalculateProportionalDimensions Method (Bitmap, Int32 %, Int32 %, ResizeMode)

Calculates parameters for resize which preserve aspect ratio of the specified bitmap.

Namespace: Aurigma.GraphicsMill.Transforms
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public Shared Sub CalculateProportionalDimensions ( _
	srcBitmap As Bitmap, _
	ByRef destWidth As Integer, _
	ByRef destHeight As Integer, _
	mode As ResizeMode _
)
C#
public static void CalculateProportionalDimensions(
	Bitmap srcBitmap,
	ref int destWidth,
	ref int destHeight,
	ResizeMode mode
)

Parameters

srcBitmap

Type: Aurigma.GraphicsMill.Bitmap

Bitmap class instance which aspect ratio you should to preserve.
destWidth

Type: System.Int32 %

Width value you need to recalculate. This value may be changed depending on the mode argument value.
destHeight

Type: System.Int32 %

Height value you need to recalculate. This value may be changed depending on the mode argument value.
mode

Type: Aurigma.GraphicsMill.Transforms.ResizeMode

ResizeMode value which specifies how to interpret destWidth and destHeight value.

Remarks

Use this method if you need to get the exact dimensions of the bitmap after proportional resize. This method recalculates specified width and height to preserve the aspect ratio of the input bitmap respecting the specified ResizeMode. Note, destWidth and destHeight are both in and out, and these values are changed by the method.

For example, you need to make sure that the bitmap after resize will fit 640x480 rectangle. In this case you should pass the following values:

  • srcBitmapAn instance of the bitmap which you are going to resize.
  • destWidthAn integer variable which is equal to 640.
  • destHeightAn integer variable which is equal to 480
  • mode Fit

After you run this method, variables you pass as destWidth and destHeight will store recalculated dimensions.

See Also

Reference