This brief tutorial describes how to resize image in C# by just loading the source image and then calling the Resize function to perform the transformation. To change image size C# code is provided along with the steps to configure the environment. You can set resize type while resizing the image of any type like JPEG, BMP, PNG, GIF, etc.
Steps to Resize Image in C#
- Configure the environment to add Aspose.Imaging to your application
- Load the source image into the Image class object
- Call the Image.Resize() method along with the resize type
- Save the output image in the desired format
Using C# change image size process is explained here with the help of sharing links to the required resources and then step-by-step tasks to complete the conversion. It is quite an easier process where just load the image and then call resize function along with the option to set the resize type like AdaptiveResample demonstrated here. However, you can use any of the resize types like LanczosResample, BilinearResample, CubicConvolution, and Bell to name a few.
Code to Resize Image in C#
This code shows how using c# image size change operation can be accomplished with the specified ResizeType. You can use another overload of the Resize function that requires ImageResizeSettings class object. This object contains ResizeType as one of the properties and provides other properties also like ColorCompareMethod, ColorQuantizationMethod, EntriesCount, FilterType, etc.
This tutorial has taught us to resize image in C#. If you want to learn the process of conversion of image type, refer to the article on how to create PNG image from BMP in C#.