BitmapExtensionsResize(Bitmap, Size, Boolean) Method

Resizes the image with high quality. The result always has a Format32bppPArgb pixel format.
This overload uses Graphics.DrawImage internally, which provides a good quality result but on Windows blocks every parallel DrawImage call within the same process. If that might be an issue use the Resize(Bitmap, Size, ScalingMode, Boolean) overload instead.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 7.2.0
C#
public static Bitmap Resize(
	this Bitmap image,
	Size newSize,
	bool keepAspectRatio = false
)

Parameters

image  Bitmap
The original image to resize
newSize  Size
The requested new size.
keepAspectRatio  Boolean  (Optional)
to keep aspect ratio of the source image; otherwise, . This parameter is optional.
Default value: .

Return Value

Bitmap
A Bitmap instance with the new size.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Bitmap. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also