imagemagick with grayscale not working

心不动则不痛 提交于 2019-12-24 09:28:58

问题


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

but it is just returning this

Invalid Parameter - -colorspace

What am I doing wrong?


回答1:


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:

Option 1

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

Option 2

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

C:\ImageMagick-6.9.3\convert ...

Option 3

Change your PATH. So you would need to do:

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

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

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

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.



来源:https://stackoverflow.com/questions/37634859/imagemagick-with-grayscale-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!