Click or drag to resize

BitmapExtensionsResize(Image, Size) Method

Returns a resized Bitmap image of the original.

Namespace: GSF.Drawing
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.300-beta+b2186e2cd1f968c931b0e151fdd7c839f3d1e9cf
Syntax
public static Bitmap Resize(
	this Image originalImage,
	Size newSize
)
View Source

Parameters

originalImage  Image
The original Bitmap image to be resized.
newSize  Size
The Size to which the original image is to be resized.

Return Value

Bitmap
A Bitmap instance.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Image. 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).
Example
This example shows how to resize an image: using System; using GSF.Drawing; using System.Drawing; class Program { static void Main(string[] args) { // Load the original image. Bitmap original = (Bitmap)Bitmap.FromFile("Original.jpg"); // Resize the original image. Bitmap originalResized = original.Resize(new Size(800, 600)); // Save the resized image to file. originalResized.Save("OriginalResized.jpg"); // Clean-up. original.Dispose(); originalResized.Dispose(); Console.ReadLine(); } }
See Also