Image 将tiff模式转换为1位图像

Image 将tiff模式转换为1位图像,image,image-processing,imagemagick,tiff,gimp,Image,Image Processing,Imagemagick,Tiff,Gimp,是否可以使用命令行工具将tiff图像转换为模式1位图像。我看到它可以用gimp完成,但我需要运行一个脚本,因此我更喜欢使用imagemagick等包的解决方案。如果图像内容已经是黑白的,您只需要转换,请使用: convert input.tif -depth 1 output.tif 如果还需要设置图像阈值,请使用以下方法: convert input.tif -separate -black-threshold 128 -depth 1 output.tif 它是否与convert-mon

是否可以使用命令行工具将tiff图像转换为模式1位图像。我看到它可以用gimp完成,但我需要运行一个脚本,因此我更喜欢使用imagemagick等包的解决方案。如果图像内容已经是黑白的,您只需要转换,请使用:

convert input.tif -depth 1 output.tif
如果还需要设置图像阈值,请使用以下方法:

convert input.tif -separate -black-threshold 128 -depth 1 output.tif

它是否与convert-monology input.tif output.tif相同?请注意,输入文件名前的标志适用于输入,而不是输出(至少手册页上是这么说的)。也就是说,结果并不完全相同。检查两者,选择最适合你的。使用阈值的优点是,您可以调整它。