如何覆盖 Windows通过 ImageMagick 的转换命令?

发布于 2024-10-08 15:28:16 字数 288 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

你的心境我的脸 2024-10-15 15:28:16

这是一个老问题,但 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".

不及他 2024-10-15 15:28:16

这是一个老问题了,但是我今天遇到了这个问题,这是我在 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 example C:\Libs\ImageMagick-6.8.8-4) before the path that loads System32 (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.

我很OK 2024-10-15 15:28:16

重命名 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 to imgconvert.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 system convert


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.

赠我空喜 2024-10-15 15:28:16

您注销并登录了吗?

或者通过提供完整路径来指定 Imagemagick 的转换

Did you logoff and login?

Or specify the Imagemagick's convert by providing the complete path

智商已欠费 2024-10-15 15:28:16

在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文