【问题标题】:Calling Image Magick commands from .Net从 .Net 调用 Image Magick 命令
【发布时间】:2013-04-16 03:23:53
【问题描述】:

我正在尝试在 .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\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/constitute.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/构成.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"

【问题讨论】:

    标签: c# .net process imagemagick


    【解决方案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\" 
    

    【讨论】:

      猜你喜欢
      • 2015-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-04
      • 2017-11-09
      相关资源
      最近更新 更多