How can I convert an image to grayscale via the co

2020-02-16 06:18发布

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

2条回答
地球回转人心会变
2楼-- · 2020-02-16 06:29

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

查看更多
仙女界的扛把子
3楼-- · 2020-02-16 06:42

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.

查看更多
登录 后发表回答