错误“无效参数” fom ImageMagick在Windows上转换 [英] Error "Invalid Parameter" fom ImageMagick convert on Windows

查看:261
本文介绍了错误“无效参数” fom ImageMagick在Windows上转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ASP.NET网站上的ImageMagick命令行工具将PDF文档转换为PNG文件。我创建了一个新的shell进程,并执行以下命令:

I am trying to convert a PDF document into a PNG file using ImageMagick command line tools from a ASP.NET website. I create a new shell process and ahve it execute the following command:

convert -density 96x96 "[FileNameAndPath].pdf" "[FileNameAndPath].png"

使用ASP在本地计算机上测试网站时运行良好。 VS的NET Develeopment Server和命令在手动输入shell时也能很好地工作。从ASP.NET中以编程方式创建的shell运行时,会出现以下错误消息:

This runs well when testing the website on my local machine with the ASP.NET Develeopment Server of VS and the command also works well when manually entered into the shell. When running from the programatically created shell in ASP.NET there is the following error message:

Invalid Parameter - 96x96

有人知道为什么会这样吗?该怎么做?

Does anybody know why that happens and what to do?

我在使用与ASP.NET进程不同的用户帐户通过RDP登录服务器时测试了该命令。我使用了与本地计算机完全相同的ImageMagick和Ghostscript安装文件,并在安装过程中激活了将ImageMagick安装路径添加到enironment变量中。服务器自从没有重新启动。

I have tested the command while being logged in on the server via RDP with a different user account than the ASP.NET process. I have used exactly the same ImageMagick and Ghostscript installation files as on my local machine and have activated adding the ImageMagick installation path to the enironment variables during installing. The server has not been rebooted since than.

推荐答案

convert 也是将FAT文件系统转换为NTFS的Windows可执行文件的名称。如果未指定可执行文件的完整路径,请引用:

convert is also the name of a windows executable which converts FAT filesystem to NTFS. When you do not specify the full path of an executable, quote:


...系统首先搜索当前工作目录,然后
搜索路径环境变量,检查每个
目录从左到右,寻找
匹配给定命令名的可执行文件名。

...the system first searches the current working directory and then searches the path environment variable, examining each directory from left to right, looking for an executable filename that matches the command name given.

C:\ Windows \\ \\ System32通常出现在%PATH%变量的开头,导致 Windows 转换实用程序启动,失败并出现无效参数错误。

"C:\Windows\System32" is generally present in the beginning of %PATH% variable, causing the Windows convert utility to launch, which fails with "Invalid Parameter" error as expected.

尝试指定ImageMagick的convert.exe的完整路径,如下所示:

Try specifying the full path of the ImageMagick's convert.exe like so:

"C:\Program Files\ImageMagick\convert.exe" -density 96x96 "path_and_filename.pdf" "path_and_filename.png"

这篇关于错误“无效参数” fom ImageMagick在Windows上转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆