我已经阅读了许多关于使用 lockbits 操作图像的 C# 教程,但我只是不知道如何将这些信息应用到 PowerShell 中。
这就是问题:
$image1 的高度为 2950 像素。$image2 的高度高 50 像素,3000 像素。我需要将 $image2 放入 $image1 中,并且可以跳过 $image2 的前 49 px 行。所以在伪代码中:
For(y=0... For(x=0.... { image1(x,y) = image2(x,y+50) } ....))
下面的 PowerShell 脚本可以运行,但运行速度不是很快:
$rect = new-object Drawing.Rectangle 0, 0, $image1.width, $image1.height
$image1drawing.drawimage($image2,
$rect,
0, 50, $image2.width, ($image2.height - 50),
$graphicalUnit)
我找到的页面,例如这个(无法成功使用 lockbits)或这个(https://web.archive.org/web/20121203144033/http://www.bobpowell.net/lockingbits.htm)是在“简单的英语”中,但如何将这个概念转换为 PowerShell?