如何通过命令行将图像转换为灰度?

时间:2011-10-10 03:49:32

标签: linux image command-line sips

如何使用sipsimagemagic或其他工具通过命令行将图像转换为黑白(灰度)?

2 个答案:

答案 0 :(得分:131)

如果您安装了imagemagick

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)

如果您不关心丢失原始文件:mogrify -colorspace Gray file

答案 1 :(得分:11)

使用以下-monochrome -colorspace gray imagemagick之内的convert或{{1}}选项之一。

相关问题