DEXTUpload.NET Professional
menu toggleReferences > DEXTUpload.NET > ImageFitOption

DEXTUpload.NET
Enumeration ImageFitOption

The minimum supported version
5.0.0.0
The minimum support environment
.NET Framework 4.0
Explanation

To change the size of the original image to the specified frame size is called fitting.

The fitting is always maintained(preserved) the ratio(aspect ratio) of the horizontal size and the vertical size of the original image.

The "ImageFitOption" is a enumeration type that represents resizing methods for fitting the original image into the frame.

The "Fit" method of the "DEXTUpload.NET.ImageProc" class is used for fitting the image, this method gets a "DEXTUpload.NET.FittingOption" object as a parameter. The " DEXTUpload.NET.FittingOption" class has the properties required to fit the image.

var source = new FileInfo("source.jpg");
using (var img = ImageProc.Fit(source, new FittingOption { 
    Width = 100, Height = 200,
    Fit = ImageFitOption.Uniform }))
{
    ImageProc.SaveImage(img, new FileInfo("output.jpg"), new ImageSaveOption { IsOverwrite = true });
}
Type
public enum ImageFitOption
Members

Uniform

  • Reducing the size of the image so that the image is stuck in the size of the specified frame.

    If the size of the original image is smaller than the frame, without changing the size of the image to maintain the original size.

    Source Frame Result
    source
    fitting

UniformToFit

  • Reducing the size of the image so that the image is stuck in the size of the specified frame.

    If the size of the original image is smaller than the frame, the original image is increased in accordance with the frame size, margins remainder of the frame is filled with the background color.

    Source Frame Result
    source
    fitting

UniformToFill

  • Change the size of the image and fill into the frame with no margins

    Source Frame Result
    source
    fitting