DEXTUpload.NET
Class FittingOption
- 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 "FittingOption" class has a set value necessary for generating the image to fit the size of the frame with maintaining the vertical/horizontal ratio.
var source = new FileInfo("image.jpg"); using (var img = ImageProc.Fit(source, new FittingOption { Width = 100, Height = 200, BackgroundColor = Color.Red, Fit = ImageFitOption.UniformToFill, HorizontalAlign = ImageHorizontalAlignment.Left, VerticalAlign = ImageVerticalAlignment.Center })) { ImageProc.SaveImage(img, new FileInfo("output.jpg"), new ImageSaveOption { IsOverwrite = true }); }
- Type
-
public class FittingOption
- Constructors
-
FittingOption
-
Does initialization when creating an instance of the "FittingOption" class.
-
Type
public FittingOption() public FittingOption(int width, int height, ImageFitOption fit, ImageHorizontalAlignment halign, ImageVerticalAlignment valign, Color backgroundColor, bool antialiasing)
-
Parameters
Name Type Explanation width System.Int32 The horizontal size(pixel) of the frame. height System.Int32 The vertical size(pixel) of the frame. fit DEXTUplod.NET.ImageFitOption The method to determine resizing. halign DEXTUpload.NET.ImageHorizontalAlignment When the resizing method is "ImageFitOption.UniformToFit" or "ImageFitOption.UniformToFill", a parameter indicating the horizontal position of the image displayed on the frame. valign DEXTUpload.NET.ImageVerticalAlignment When the resizing method is "ImageFitOption.UniformToFit" or "ImageFitOption.UniformToFill", a parameter indicating the vertical position of the image displayed on the frame. backgroundColor System.Drawing.Color When the resizing method is "ImageFitOption.UniformToFit", a parameter that specifies the background color. antialiasing System.Boolean When the image is rendered, sets whether or not the anti-aliasing effect.
-
- Properties
-
Width
-
Gets or sets the horizontal size(pixel) of the frame.
The default value is 0.
-
Type
public int Width { get; set; }
Height
-
Gets or sets the vertical size(pixel) of the frame.
The default value is 0.
-
Type
public int Height { get; set; }
Fit
-
Gets or sets a "DEXTUpload.NET.ImageFitOption" value to determine a method of reszing images.
The default is "ImageFitOption.Uniform".
-
Type
public ImageFitOption Fit { get; set; }
HorizontalAlign
-
Gets or sets a "DEXTUpload.NET.ImageHorizontalAlignment" value indicating the horizontal position that is a place of rendering image in the frame.
When the resizing method is "ImageFitOption.UniformToFit" or "ImageFitOption.UniformToFill", it is used, the default is "ImageHorizontalAlignment.Center".
-
Type
public ImageHorizontalAlignment HorizontalAlign { get; set; }
VerticalAlign
-
Gets or sets a "DEXTUpload.NET.ImageVerticalAlignment" value indicating the vertical position that is a place of rendering image in the frame.
Whe the resizing method is "ImageFitOption.UniformToFit" or "ImageFitOption.UniformToFill", it is used, the default is "ImageVerticalAlignment.Center".
-
Type
public ImageVerticalAlignment VerticalAlign { get; set; }
BackgroundColor
-
Gets or sets a "System.Drawing.Color" object to determine background color.
When the resizing method is "ImageFitOption.UniformToFit", it is used, the default is "Color.Black".
-
Type
public Color BackgroundColor { get; set; }
UseAntialiasing
-
Gets or sets whether or not using antialiasing effect when rendering a image.
By default, it is "true".
-
Type
public bool UseAntialiasing { get; set; }
-