为什么在 ImageMagick 中转换不起作用

Why convert in ImageMagick not working

我尝试从 windows 10 命令行在 ImageMagick 中将 pdf 文件转换为 png 图像,如下所示:

convert a.pdf a.png

但我收到错误:无效参数 - a.png。我想知道为什么。 ImageMagick 已正确安装为 magick wizard.jpg win: 弹出图像。

我猜你打错了convert。使用 where 确定您实际上是哪个可执行文件 运行。

此外,请务必注意 windows 上 imagemagick 的一些 strange behaviors

convert 可能是 Windows 上的另一个命令(参见 convert issue

另请注意,从版本 7 开始

The "magick" command is the new primary command of the Shell API, replacing the old "convert" command.

(来自 https://imagemagick.org/script/porting.php

所以你应该使用:

magick a.pdf a.png

扩展 @Ben Harris 的回答 Windows 有一个转换程序,可以从内存中重命名默认选择的文件。如果您允许 Imagemagick 在安装时将其自身添加到环境变量中,它应该可以正常工作。

您可以将 convert 更改为 Imagemagick convert.exe 的路径或将 convert.exe 重命名为其他名称(例如 IMconvert.exe)以防止混淆。然后使用 IMconvert.exe 代替 convert.

正如@user2314737 所说,Imagemagick 的版本 7 使用 magick 而不是 convert 来防止该问题。 (尝试magick.exe)