Resize Class

Resizes an image.

Namespace: Aurigma.GraphicsMill.Transforms
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public sealed class Resize : Transform

Remarks

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.

Examples

The following code proportionally resizes an image to 100 pixel width.

C#
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");
}

Inheritance Hierarchy

System.Object

Thread Safety

Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.

See Also

Reference

Manual