我正在尝试在.NET应用程序中调用Image Magick。当我复制相同的参数并使用命令行来调用它时,这是非常奇怪的。没关系,但是当我通过我的C#应用程序调用它时,我最后得到了错误。当我通过我的应用程序调用它时,我不知道它是怎么期望一个Affine参数。请帮忙。
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = @"C:\Program Files (x86)\ImageMagick-6.8.4-Q16\convert.exe",
Arguments = "\"C:\\Users\\Pouya\\Desktop\\Rugs\\test.jpg\" -matte -virtual-pixel transparent -distort Perspective ' 2,2 0,0 2,198 0,200 198,198 200,200 198,2 200,0' \"C:\\Users\\Pouya\\Desktop\\Rugs\\testResult.jpg\"",
UseShellExecute = false,
RedirectStandardError = true,
CreateNoWindow = true
}
};
proc.Start();`
“convert.exe:选项Affine的无效参数:'需要至少1个CP'@ error / distort.c / GenerateCoefficients / 530。\ r \ n nconvert.exe:无法打开图像2,2': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
2, 2'@ error / construct.c / ReadImage / 550。\ r \ n \ nconvert.exe:无法打开图像0,0': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
0,0'@ error / construct.c / ReadImage / 550。\ r \ n nconvert.exe :无法打开图像2,198': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
2,198'@ error / construct.c / ReadImage / 550。\ r \ n nconvert.exe:无法打开图像0,200': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
0,200'@ error / construct.c / ReadImage / 550. \ r \ n \ nconvert.exe:无法打开图像198,198': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
198,198'@ error / construct.c / ReadImage / 550。\ r \ n \ nconvert.exe:无法打开图像200,200': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
200,200'@ error / construct.c / ReadImage / 550。\ r \ n nconvert.exe:无法打开图像198,2': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
198,2'@ error / construct.c / ReadImage / 550。\ r \ n \ nconvert.exe:无法打开图片200,0'': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format
200,0''@ error / construct.c / ReadImage / 550。\ r \ n“
答案 0 :(得分:1)
将' 2,2 0,0 2,198 0,200 198,198 200,200 198,2 200,0'
周围的单引号更改为转义双引号。在第一次引用后立即摆脱额外的领先空间:
\"2,2 0,0 2,198 0,200 198,198 200,200 198,2 200,0\"