Resizes an image.
Namespace:
Aurigma.GraphicsMill.Transforms
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public sealed class Resize : Transform
Using this class you may resample the bitmap: specify Width and Height properties, then apply the transform, and it will return resized bitmap. If you set some of these properties to 0, this property is automatically calculated to preserve the aspect ratio of the image.
Essential parameter of all the geometric transforms (including resizing) is an interpolation algorithm. It specifies how to calculate intermediate points. Different algorithms produces different quality, but as usual the higher quality it produces, the slower algorithm works. You can select interpolation algorithm with InterpolationMode property.
The following code proportionally resizes an image to 100 pixel width.
using (var bitmap = new Bitmap(@"Images\in.jpg")) using (var resize = new Resize(100, 100)) { resize.InterpolationMode = ResizeInterpolationMode.High; resize.ResizeMode = ResizeMode.Fit; using (var result = resize.Apply(bitmap)) result.Save(@"Images\Output\out.jpg"); }