powershell 图像转换

powershell image transformation

我想在powershell中进行图片转换。基本上我想在另一张图片上插入一个包含不同比例 red/blue/green 和黄色(这因图片而异)的圆圈。

现在我迷上了 PSImageTools (http://psimagetools.start-automating.com/),但据我所知,它们只允许我将一张图片叠加到另一张图片上,但由于 4 种颜色的比例不同,我必须动态创建一个可以映射到现有图片上的圆。

如何执行我需要的硬核像素,不仅仅是将 2 个图像粘贴在一起,而是在 powershell 中定义单个像素的颜色?

以下对图像进行编辑:

$imageOld = "C:\My\File.jpg"
$imagenew = "C:\My\File2.jpg"

# Load the System.Windows.Forms library
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");

$image    = [System.Drawing.Image]::FromFile($imageOld)
$graphics = [System.Drawing.Graphics]::FromImage($image)

# 50% transparent white
$color    = [System.Drawing.Color]::FromArgb(128, 255, 255, 255)
$brush    = New-Object System.Drawing.SolidBrush($color)

# Draw a 500px circle located at (300, 300)
$graphics.FillEllipse($brush, 300, 300, 500, 500)

$image.Save($imageNew)