|
BitmapExtensionsResize(Image, Size, Boolean) Method
|
Returns a resized
Bitmap image of the original.
Namespace: GSF.DrawingAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.293-beta+b9f6fb0447e0fddffa5bbbc6db4d9737c334ae9a
SyntaxGSF.Drawing.BitmapExtensions.Resize = function(originalImage, newSize, disposeOriginal);
View SourceParameters
- originalImage Image
- The original Bitmap image to be resized.
- newSize Size
- The Size to which the original image is to be resized.
- disposeOriginal Boolean
- true if the original image is to be disposed after resizing it; otherwise false.
Return Value
BitmapA
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 and dispose the original image that was resized:
using System;
using System.Drawing;
using GSF.Drawing;
class Program
{
static void Main(string[] args)
{
// Load original, resize it, and dispose original.
using (Bitmap resized = ((Bitmap)Bitmap.FromFile("Original.jpg")).Resize(new Size(800, 600), true))
{
// Save the resized image to file.
resized.Save("OriginalResized.jpg");
}
Console.ReadLine();
}
}
See Also