Please use. NET 5,. NET 6, NET 7,. NET 8, NET Framework 4.6, NET Framework 4.61, NET Framework 4.7, NET Framework 4.72, NET Framework 4.8, NET Framework 4.81, and. NET Core 3.1 versions

ImageResizeMode 枚举

Specifies how images should be resized during preprocessing 指定预处理期间图像应该如何调整大小

Definition

命名空间: DeploySharp.Data
程序集: DeploySharp (在 DeploySharp.dll 中) 版本:0.0.4+6e8a2e904469617cd59619d666c0e272985c0e33
C#
public enum ImageResizeMode

备注

Controls the aspect ratio behavior when resizing images to target dimensions. Different modes affect how bounding boxes should be interpreted post-resize.

控制将图像调整到目标尺寸时的宽高比行为。 不同模式会影响调整大小后边框的解释方式。

示例

Usage example:
C#
// Configure processor with padding resize mode
var config = new DataProcessorConfig {
    ResizeMode = ImageResizeMode.Pad
};

成员

Stretch0 Stretches the resized image to fit the bounds of its container. Both width and height will exactly match target dimensions, potentially distorting the original aspect ratio. 拉伸调整后的图像以适应容器边界。 宽度和高度将完全匹配目标尺寸, 可能会扭曲原始宽高比。
Pad1 Pads the resized image to fit the bounds of its container. Maintains original aspect ratio by adding padding bars when necessary. If only one dimension is specified, will maintain original aspect ratio. 填充调整后的图像以适应容器边界。 必要时通过添加填充条保持原始宽高比。 如果仅指定一个尺寸,将保持原始宽高比。
Max2 Constrains the resized image to fit the bounds of its container while maintaining the original aspect ratio. The resulting image will not exceed target dimensions in either axis, but may be smaller than target dimensions in one axis. 约束调整后的图像以适应容器边界, 同时保持原始宽高比。 生成的图像在任何轴上都不会超过目标尺寸, 但可能在一个轴上小于目标尺寸。
Crop3 Crops the resized image to fit the bounds of its container. Maintains aspect ratio by centering and cropping overflow areas. 裁剪调整后的图像以适应容器边界。 通过居中并裁剪溢出区域保持宽高比。

参见