Divooka.DSL.ImageProcessing.zh

Divooka.DSL.ImageProcessing.ImageFileFormatConversion

Deals with file format conversion on the file level (file system level operations)

Divooka.DSL.ImageProcessing.ImageFileFormatConversion.Convert()

这个简单的函数替换了许多外部文件转换工具。

Divooka.DSL.ImageProcessing.ImageConversionHelper.ConvertFromSKImage()

将SKImage(来自SkiaSharp)直接转换为Divooka.Types.Image。

Parameters

NameDescriptionDefault
skImage The source SKImage.

从SKImage的像素数据构建的Divooka.Types.Image

A Divooka.Types.Image built from the SKImage's pixel data.

Divooka.DSL.ImageProcessing.ImageProcessor

Remarks

TODO: Not tested as of 2025-02-17. Majority of the code generated with ChatGPT.

Divooka.DSL.ImageProcessing.ImageProcessor.#ctor()

加载并初始化基于图像文件类型的基本属性。

Parameters

NameDescriptionDefault
imagePath 图像文件的路径。支持多种扩展名。

Divooka.DSL.ImageProcessing.ImageProcessor.Grayscale

Returns a new ImageProcessor with the image converted to grayscale.

返回一个新的图像处理器,图像已转换为灰度。

Divooka.DSL.ImageProcessing.ImageProcessor.Invert

返回一个新的 ImageProcessor,其中颜色被反转。

Divooka.DSL.ImageProcessing.ImageProcessor.AdjustBrightness()

返回一个新的图像处理器,其亮度已调整。

Parameters

NameDescriptionDefault
value 亮度偏移值范围在[-255..255]之间。

调整后的图像处理器

返回调整后的图像处理器。

Divooka.DSL.ImageProcessing.ImageProcessor.AdjustContrast()

返回一个对比度已调整的新 ImageProcessor。

Parameters

NameDescriptionDefault
contrast 对比度因子,其中 1 为不变。

调整后的图像处理器

Divooka.DSL.ImageProcessing.ImageProcessor.AdjustSaturation()

返回一个新的图像处理器,饱和度已调整。

Parameters

NameDescriptionDefault
saturation 饱和度因子,其中1表示没有变化。

调整后的图像处理器

Divooka.DSL.ImageProcessing.ImageProcessor.HueShift()

返回一个新的 ImageProcessor,其色相根据指定的度数进行了偏移。

Parameters

NameDescriptionDefault
degrees 用于偏移色相的度数。负值向后偏移。

新的 ImageProcessor

返回一个新的 ImageProcessor。

Divooka.DSL.ImageProcessing.ImageProcessor.Blur()

返回应用高斯模糊的新 ImageProcessor。

Parameters

NameDescriptionDefault
radius 模糊半径。

Divooka.DSL.ImageProcessing.ImageProcessor.Sharpen()

Returns a new ImageProcessor with a sharpen effect applied.

Parameters

NameDescriptionDefault
amount Sharpen intensity.

返回新的图像处理器

Returns a new ImageProcessor.

Divooka.DSL.ImageProcessing.ImageProcessor.Resize()

返回一个新的 ImageProcessor,图像的大小调整为指定的宽度和高度。

Divooka.DSL.ImageProcessing.ImageProcessor.Rotate()

返回一个新的 ImageProcessor,图像按指定的度数旋转。

旋转后的图像处理器

Divooka.DSL.ImageProcessing.ImageProcessor.Crop()

返回一个新的 ImageProcessor,其中包含图像的裁剪区域。

Divooka.DSL.ImageProcessing.ImageProcessor.ToSKBitmap

Converts the current Divooka.Types.Image (i.e. Pixel[][]) to an SKBitmap.

Divooka.DSL.ImageProcessing.ImageProcessor.ConvertSKBitmapToPixels()

将 SKBitmap 转换为行主序的 2D 像素数组。

Divooka.DSL.ImageProcessing.ImageProcessor.LoadPixelsFromFile()

Uses SkiaSharp to decode the file into a 2D pixel array.

Parameters

NameDescriptionDefault
fileName

Divooka.DSL.ImageProcessing.ImageProcessor.CreateTempPngFromOtherFormat()

Remarks

用于使用BigGustave或SkiaSharp来初始化图像处理器。 如果文件已经是PNG格式,请直接使用;否则使用SkiaSharp进行转换:base((Path.GetExtension(imagePath).ToLowerInvariant() == ".png") ? imagePath : CreateTempPngFromOtherFormat(imagePath), doNotLoad: true)

Divooka.DSL.ImageProcessing.OneShotProcessing

提供使用 Magick.NET 的一次性图像处理方法。

Divooka.DSL.ImageProcessing.OneShotProcessing.FlipImageHorizontally()

翻转图像,使其水平对称(从左到右镜像)。

Parameters

NameDescriptionDefault
originalImage The path to the original image file.
outputImage The path where the transformed image will be saved.

Divooka.DSL.ImageProcessing.OneShotProcessing.FlipImageVertically()

垂直翻转图像(自上而下地镜像)。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 转换后图像将保存的路径。

变换后的图像路径

Divooka.DSL.ImageProcessing.OneShotProcessing.RotateImageClockwise90Degrees()

将图像顺时针旋转90度。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 变换后的图像将保存到的路径。

旋转后的图像

返回顺时针旋转后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.RotateImageCounterclockwise90Degrees()

逆时针旋转图像90度。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 转换后图像将被保存的路径。

返回的图像

返回旋转后的图像文件。

Divooka.DSL.ImageProcessing.OneShotProcessing.ResizeImage()

调整图像大小以保持宽高比,同时设置为指定宽度。

Parameters

NameDescriptionDefault
originalImage The path to the original image file.
outputImage The path to the output image file.
newWidth The new width for the image.

调整后的图像

Returns the resized image.

Divooka.DSL.ImageProcessing.OneShotProcessing.ResizeImage()

将图像调整为指定宽度,并根据需要通过裁剪或填充来调整高度以匹配所需大小。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 输出图像文件的路径。
newWidth 图像的新宽度。
newHeight 图像的新高度。
fillColor 如果调整大小后的图像高度低于所需高度,则使用的填充颜色。 如果调整大小后的图像比所需的高度高,则进行中心裁剪。 如果未提供,则默认为白色。

返回状态

表示调整大小操作的状态。

Divooka.DSL.ImageProcessing.OneShotProcessing.ResizeImage()

调整图像大小到指定的尺寸,如果需要,使用提供的填充颜色。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 输出图像文件的路径。
newSize 图像的新尺寸。
fillColor 在需要时用于扩展画布的填充颜色。

返回的图像

调整后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.CropImage()

裁剪图像到指定的矩形区域。如果裁剪区域超出了原始图像的边界,缺失的区域将填充指定的填充颜色。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 输出图像文件的路径。
offsetX 裁剪开始的X偏移(以像素为单位)。
offsetY 裁剪开始的Y偏移(以像素为单位)。
cropWidth 裁剪区域的宽度(以像素为单位)。
cropHeight 裁剪区域的高度(以像素为单位)。
fillColor 用于原始图像边界外区域的填充颜色。如果未提供,默认设置为白色。

裁剪结果

返回裁剪后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.CropImage()

将图像裁剪为由偏移量向量和大小定义的指定矩形。

Parameters

NameDescriptionDefault
originalImage 原始图像文件的路径。
outputImage 输出图像文件的路径。
offset 裁剪应开始的偏移量(以像素为单位)。
cropSize 裁剪区域的大小(以像素为单位)。
fillColor 用于原始图像边界外区域的填充颜色。

裁剪结果

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustBrightnessContrast()

调整图像的亮度和对比度。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
brightness 亮度调整的百分比。 0表示没有变化;正值使亮度变亮,负值使亮度变暗。
contrast 对比度调整的百分比。 0表示没有变化;正值增加对比度,负值减少对比度。

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustSaturation()

调整图像的饱和度。

Parameters

NameDescriptionDefault
originalImage Path to the original image.
outputImage Path for the output image.
saturation 饱和度水平,以百分比表示。 100表示图像不变;高于100的值增加饱和度, 低于100的值减少饱和度。

返回的图像

The adjusted image with the new saturation.

Divooka.DSL.ImageProcessing.OneShotProcessing.GaussianBlur()

对图像应用高斯模糊。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
radius 模糊半径。
sigma 模糊的标准差(sigma)。

返回结果

应用高斯模糊后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.MotionBlur()

将运动模糊应用于图像。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
radius 模糊半径。
sigma 模糊的标准差(sigma)。
angle 运动模糊的角度(以度为单位)。

Divooka.DSL.ImageProcessing.OneShotProcessing.Sharpen()

锐化图像。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
radius 锐化效果的半径。
sigma 锐化效果的sigma。

返回值

锐化后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.UnsharpMask()

应用不锐化掩模到图像。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
radius 不锐化掩模的半径。
sigma 不锐化掩模的sigma。
amount 锐化的数量。
threshold 不锐化掩模的阈值。

返回值

Divooka.DSL.ImageProcessing.OneShotProcessing.RecolorImage()

通过以指定的不透明度覆盖指定颜色来重新着色图像。

Parameters

NameDescriptionDefault
originalImage Path to the original image.
outputImage Path for the output image.
overlayColor The color to overlay on the image.
opacity 覆盖的不透明度,单位为百分比。 0使覆盖完全透明,而100使其完全不透明。

返回的图像

返回重新着色后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.ApplyLUT()

将查找表(LUT)应用于图像。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
lutImage LUT图像的路径。
outputImage 输出图像的路径。

返回图像路径

应用LUT后生成的图像路径。

Divooka.DSL.ImageProcessing.OneShotProcessing.ReduceNoise()

减少图像中的噪声。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
order 用于噪声减少的尺寸。

减噪结果

处理后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.ConvertToGrayscale()

将图像转换为灰度。

Parameters

NameDescriptionDefault
originalImage Path to the original image.
outputImage Path for the output image.

灰度图像

返回转换后的灰度图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustHSL()

使用HSL(色调、饱和度、亮度)值调整图像。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
hue 色调调整值(以度为单位)。
saturation 饱和度水平(以百分比表示)。 100表示无变化。
luminance 亮度水平(以百分比表示)。 100表示无变化。

Divooka.DSL.ImageProcessing.OneShotProcessing.GammaCorrection()

对图像应用伽马校正。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
gamma 要应用的伽马值(通常在0.1到3.0之间)。

返回值

无返回值。

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustLevels()

调整图像的级别。

Parameters

NameDescriptionDefault
originalImage The path to the original image.
outputImage The path for the output image.
blackPoint The black point value.
whitePoint The white point value.
gamma The gamma correction value.

返回值

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustShadowsHighlights()

使用 sigmoid 对比度调整图像的阴影和高光。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
shadows 调整阴影的量。 使用正值来增强阴影对比度,使用负值来柔化阴影。
highlights 调整高光的量。 使用正值来增强高光对比度,使用负值来柔化高光。

Divooka.DSL.ImageProcessing.OneShotProcessing.ApplyPerspectiveDistortion()

应用透视失真到图像,使用控制点。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
controlPoints 一个双精度数组,表示源坐标和目标坐标对。 数组必须包含正好 16 个元素,顺序如下: srcX1, srcY1, dstX1, dstY1, srcX2, srcY2, dstX2, dstY2, srcX3, srcY3, dstX3, dstY3, srcX4, srcY4, dstX4, dstY4。

返回值说明

返回失真处理后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustSelectiveSaturation()

选择性地调整与目标颜色匹配的区域的饱和度,允许给定的容差。

Parameters

NameDescriptionDefault
originalImage The path to the original image.
outputImage The path for the output image.
targetColor The target color for selective adjustment.
tolerance The tolerance as a ImageMagick.Percentage (e.g. new Percentage(10) for 10%).
saturation The saturation level as a percentage to apply on the selected areas. 100 means no change; values above 100 increase saturation, while below decrease it.

返回值

选择性调整后图像的路径。

Divooka.DSL.ImageProcessing.OneShotProcessing.ApplyVignette()

对图像应用渐晕效果。

Parameters

NameDescriptionDefault
originalImage 图像的原始路径。
outputImage 输出图像的路径。
radius 渐晕效果的半径。
sigma 渐晕效果的sigma值。
x x椭圆的偏移。
y y椭圆的偏移。

Divooka.DSL.ImageProcessing.OneShotProcessing.ApplyEmboss()

对图像应用浮雕效果。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
radius 浮雕效果的半径。
sigma 浮雕效果的sigma值。

返回变量

应用的浮雕效果图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.ApplyOilPaintEffect()

将油画效果应用于图像。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
radius 油画效果的半径。
sigma 油画效果的sigma。拉普拉斯的标准差,以像素为单位。

返回图像效果

返回应用油画效果后的图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.AddText()

在给定位置将指定文本添加到图像中。

Parameters

NameDescriptionDefault
originalImage 原始图像的路径。
outputImage 输出图像的路径。
text 要添加的文本。
location 文本绘制的位置(以像素为单位)。
font 要使用的字体系列名称。
fontSize 字体大小。
color 文本的颜色。

返回值

无返回值。

Divooka.DSL.ImageProcessing.OneShotProcessing.CompositeImages()

将覆盖图像与基础图像合成,使用指定的合成操作符和偏移量。

Parameters

NameDescriptionDefault
baseImagePath 基础图像的路径。
overlayImagePath 覆盖图像的路径。
outputImage 输出图像的路径。
offset 覆盖应用的偏移(以像素为单位)。
compositeOperator 用于组合图像的合成操作符。

返回结果图像

合成后的结果图像。

Divooka.DSL.ImageProcessing.OneShotProcessing.AdjustColorBalance()

调整图像的色彩平衡,通过为红色、绿色和蓝色通道添加偏移。

Parameters

NameDescriptionDefault
originalImage Path to the original image.
outputImage Path for the output image.
redOffset The offset to add to the red channel (negative or positive, in the Q8 range 0-255).
greenOffset The offset to add to the green channel.
blueOffset The offset to add to the blue channel.

返回值

The adjusted image with the applied color balance.

Divooka.DSL.ImageProcessing.OneShotProcessing.InvertColors()

反转图像的颜色。

Parameters

NameDescriptionDefault
originalImage Path to the original image.
outputImage Path for the output image.

反转后的图像

The inverted image.

Divooka.DSL.ImageProcessing.Utilities.ParcelFrontendImagePreviewSupport.PreviewImage()

使用硬编码协议启用预览;将来在我们拥有更好的上下文提示(例如,通过包元数据)时,这将不再是必要的。

Divooka.DSL.ImageProcessing.Utilities.Stiching

将图像缝合在一起以进行比较。

Remarks

根据 https://github.com/Pure-the-Language/CentralSnippets/blob/main/Snippets/ImageProcessing/StitchImages.cs

Divooka.DSL.ImageProcessing.Utilities.Stiching.StichImages()

从文件中拼接图像,使用图像名称作为标签