如何覆盖 Windows通过 ImageMagick 的转换命令?
在Windows中,名为convert
的命令用于转换文件系统。当您输入 convert
时,它会要求您指定文件系统。
在ImageMagick中,convert
命令用于图像处理。
问题是,即使为 ImageMagick convert
设置了环境变量,该工具也不会被调用。它仅调用 Windows convert
命令。如何覆盖它?
In Windows, a command called convert
is used to convert the filesystems. When you type convert
, it will ask you to specify a filesystem.
In ImageMagick, convert
command is used for image processing.
The problem is, even after setting the environment variable for ImageMagick convert
, the tool doesn't get invoked. It calls only the Windows convert
command. How to override that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是一个老问题,但 ImageMagick 7 当前的解决方案是使用“magick”命令代替“convert”。
This is an old question, but the current solution with ImageMagick 7 is to use the "magick" command in place of "convert".
这是一个老问题了,但是我今天遇到了这个问题,这是我在 Windows 7 中的解决方案。
Windows Convert.exe 位于文件夹
C:\Windows\System32
中,因此您必须修改Windows PATH 变量,方法是将 ImageMagick 路径(例如C:\Libs\ImageMagick-6.8.8-4
)放在加载System32
的路径(即%SystemRoot%\System32
)。这将导致所有 ImageMagick 可执行文件优先于任何类似命名的系统可执行文件,这应该执行您想要的操作,但可能会导致意外行为。
另外,当您想使用系统convert.exe时,您必须指定完整路径名,例如
C:\Windows\System32\convert.exe
。This is an old question, but I encountered this problem today, and this is my solution in Windows 7.
Windows convert.exe is located in folder
C:\Windows\System32
, so you have to modify the Windows PATH variable by putting the ImageMagick path (for exampleC:\Libs\ImageMagick-6.8.8-4
) before the path that loadsSystem32
(ie.%SystemRoot%\System32
).This will cause all ImageMagick executables to take priority over any similarly named system executables, which should do what you want but may cause unexpected behaviour.
Also, when you want to use the system convert.exe, you'll have to specify the full pathname such as
C:\Windows\System32\convert.exe
.重命名 ImageMagick
convert.exe
对我来说效果很好。我不喜欢每次都使用完整路径,并且在工作电脑上更改系统 PATH 变量对我来说是不可能的。
将
convert.exe
重命名为imgconvert.exe
后,无需进行其他更改。现在,您可以在命令行中的任何位置使用新命令,而不会与固有的 Windows 文件系统转换
编辑相混淆:从版本 7.0 开始,该命令现在为
magick.exe
,它不再与任何本机 Windows 命令发生冲突。因此,如果可能的话,下载最新版本也应该可以解决问题。Renaming the ImageMagick
convert.exe
worked well for me.I didn't like using full path each time, and changing the system PATH variable isn't possible for me on the work PC.
After renaming
convert.exe
toimgconvert.exe
, no other changes were needed. You could now use the new command anywhere from the command line without it being confused with the intrinsic Windows file systemconvert
Edit: As of version 7.0, the command is now
magick.exe
, which no longer clashes with any native windows commands. So downloading the latest version if possible should solve the problem as well.您注销并登录了吗?
或者通过提供完整路径来指定 Imagemagick 的转换
Did you logoff and login?
Or specify the Imagemagick's convert by providing the complete path
在 powershell 中,您可以运行以下命令:
$env:Path = "C:\path-to-convert\;$env:Path"
现在,可以找到 imagemagick 转换 exe,因为它位于路径的第一个位置。
In powershell you can run this:
$env:Path = "C:\path-to-convert\;$env:Path"
Now the imagemagick convert exe gets found because it comes first in the path.