imagemagick与灰度无法正常工作 [英] imagemagick with grayscale not working

查看:313
本文介绍了imagemagick与灰度无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将名为anvil_base.png的文件更改为灰度,因此我使用的是imagemagick。我输入的是转换anvil_base.png -colorspace灰色-gamma 2.2 anvil_base.png

I am trying to change a file named "anvil_base.png" to grayscale so I am using imagemagick. What I am entering is convert anvil_base.png -colorspace Gray -gamma 2.2 anvil_base.png

但它只是返回此

无效参数 - -colorspace

我做错了什么?

推荐答案

我怀疑你在Windows上并且你没有把ImageMagick的安装目录放在PATH中的其他目录。您有三种选择:

I suspect you are on Windows and you have not put the directory where ImageMagick is installed ahead of other directories in your PATH. You have three choices:

选项1

正如Glenn所指出的那样,如果你使用的是ImageMagick 7或更新版本,你可以使用 convert 的新名称,这是 magick ,就像这样:

As Glenn kindly points out, if you are using ImageMagick version 7 or newer, you can use the new name for convert which is magick, like this:

magick image.png -colorspace gray ...

选项2

使用完整路径ImageMagick每次都是这样的:

Use the full path to ImageMagick every time, something like this:

C:\ImageMagick-6.9.3\convert ...

选项3

改变你的路径。所以你需要这样做:

Change your PATH. So you would need to do:

Start->Programs->Control Panel->System->Advanced

然后选择环境变量并更改 PATH 如下所示:

and then choose Environment Variables and change PATH so that it looks like:

PATH=C:\ImageMagick-6.9.3;C:\Windows;C:\Windows\System32

主要的事情是ImageMagick目录位于PATH的开头。然后,Windows会在找到内置Windows convert convert ,它是 ImageMagick 的一部分$ c>将FAT文件系统转换为NTFS的程序。如果选择上面的选项3,则需要注销并重新登录,或者启动新的命令提示符以使新PATH变为活动状态。

The main thing is that ImageMagick directory is at the start of the PATH. Then Windows will find the convert which is part of ImageMagick before it finds the built-in Windows convert program which converts FAT filesystems to NTFS. If you choose Option 3 above, you need to either log out and back in again, or start a new Command Prompt for the new PATH to become active.

这篇关于imagemagick与灰度无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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