Resize image files in C# and VB.NET

It's often necessary to resize images to fit the standards of a platform or a document. With GemBox.Imaging, you can resize image files from your C# or VB.NET application.

TThe following example shows how to resize images and save them to various formats programmatically. You will use the image.Resize() method for this purpose.

Image file which is resized using GemBox.Imaging
Screenshot of image file resized using GemBox.Imaging
Upload your file (Drag file here)
using GemBox.Imaging;

class Program
{
    static void Main()
    {
        // If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var image = Image.Load("%InputFileName%"))
        {
            // Resizing the image
            image.Resize(128, 85);

            // Saving the resized image
            image.Save("Resized.png");
        }
    }
}
Imports System
Imports GemBox.Imaging

Module Program

	Sub Main()

		' If using Professional version, put your serial key below.
		ComponentInfo.SetLicense("FREE-LIMITED-KEY")
		
		Using image As Image = Image.Load("%InputFileName%")
			' Resizing the image
			image.Resize(128, 85)

			' Saving the resized image
			image.Save("Resized.png")
		End Using
	End Sub
End Module

See also


Next steps

GemBox.Imaging is a .NET component that provides an easy way to load, edit, save images. GemBox.Imaging also supports file format conversions and image transformations (resize, crop, rotate and flip).

Download Buy