|
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.258-beta+f8b6aa3dbfe0b4cc2b0b0760dd5d2a3dd4f59d09
Syntaxpublic static Bitmap Resize(
this Image originalImage,
Size newSize,
bool disposeOriginal
)
<ExtensionAttribute>
Public Shared Function Resize (
originalImage As Image,
newSize As Size,
disposeOriginal As Boolean
) As Bitmap
public:
[ExtensionAttribute]
static Bitmap^ Resize(
Image^ originalImage,
Size newSize,
bool disposeOriginal
)
[<ExtensionAttribute>]
static member Resize :
originalImage : Image *
newSize : Size *
disposeOriginal : bool -> Bitmap GSF.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)
{
using (Bitmap resized = ((Bitmap)Bitmap.FromFile("Original.jpg")).Resize(new Size(800, 600), true))
{
resized.Save("OriginalResized.jpg");
}
Console.ReadLine();
}
}
See Also