How can I convert an image to grayscale via the command line? [closed]

梦想与她 提交于 2019-11-28 14:49:02

问题


How can I use sips, imagemagic, or another tool to convert an image to black and white (grayscale) via the command line?


回答1:


If you have imagemagick installed,

convert source.jpg -colorspace Gray destination.jpg (true grayscale only)
convert source.jpg -monochrome destination.jpg (true black and white)
convert source.jpg -separate destination.jpg (separate into gray channels)

If you don't care about losing the original file: mogrify -colorspace Gray file.




回答2:


use one of: -monochrome or -colorspace gray options for imagemagick (convert).



来源:https://stackoverflow.com/questions/7708368/how-can-i-convert-an-image-to-grayscale-via-the-command-line

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