0

我正在尝试在 .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:选项仿射的无效参数:'需要至少 1 个 CP'@error/distort.c/GenerateCoefficients/530。\r\nconvert.exe: 无法打开图像2,2': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format2,2'@error/constitute.c /ReadImage/550。\r\nconvert.exe: 无法打开图像0,0': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format0,0'@error/constitute.c/ReadImage/550。\r\nconvert.exe: 无法打开图像2,198': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format2,198'@error/constitute.c /ReadImage/550。\r\nconvert.exe: 无法打开图像0,200': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format0,200' @error/constitute.c/ReadImage/550。\r\nconvert.exe: 无法打开图像198,198': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format198,198' @error/constitute.c/ReadImage /550。\r\nconvert.exe: 无法打开图像200,200': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format200,200'@error/composee.c/ReadImage/550。\r\nconvert.exe: 无法打开图像198,2': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format198,2'@error/constitute.c/ReadImage /550.\r\nconvert.exe: 无法打开图像200,0'': No such file or directory @ error/blob.c/OpenBlob/2641.\r\nconvert.exe: no decode delegate for this image format200,0'' @错误/构成.c/ReadImage/550。\r\n"

4

1 回答 1

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\" 
于 2013-04-16T03:34:04.970 回答