如何使用 sips、 imagemagic或其他工具通过命令行将图像转换为黑白(灰度) ?
sips
imagemagic
use one of: -monochrome or -colorspace gray options for imagemagick (convert).
-monochrome
-colorspace gray
imagemagick
convert
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.
mogrify -colorspace Gray file