BitmapExtensionsResize(Bitmap, Size, ScalingMode, Boolean) Method
Resizes the image using the specified
scalingMode. The result always has a
Format32bppPArgb pixel format.
Namespace: KGySoft.DrawingAssembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 9.2.0
public static Bitmap Resize(
this Bitmap image,
Size newSize,
ScalingMode scalingMode,
bool keepAspectRatio = false
)
<ExtensionAttribute>
Public Shared Function Resize (
image As Bitmap,
newSize As Size,
scalingMode As ScalingMode,
Optional keepAspectRatio As Boolean = false
) As Bitmap
public:
[ExtensionAttribute]
static Bitmap^ Resize(
Bitmap^ image,
Size newSize,
ScalingMode scalingMode,
bool keepAspectRatio = false
)
[<ExtensionAttribute>]
static member Resize :
image : Bitmap *
newSize : Size *
scalingMode : ScalingMode *
?keepAspectRatio : bool
(* Defaults:
let _keepAspectRatio = defaultArg keepAspectRatio false
*)
-> Bitmap
- image Bitmap
- The original image to resize
- newSize Size
- The requested new size.
- scalingMode ScalingMode
- A ScalingMode value, which determines the quality of the result as well as the processing time.
- keepAspectRatio Boolean (Optional)
- to keep aspect ratio of the source image; otherwise, . This parameter is optional.
Default value: .
BitmapA
Bitmap instance with the new size.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).