将 tiff 转换为模式 1 位图像

iLo*_*ase 2 tiff image imagemagick image-processing gimp

是否可以使用命令行工具将 tiff 图像转换为模式 1 位图像。我看到它可以用 gimp 来完成,但我需要运行一个脚本,所以我更喜欢使用像 imagemagick 等包的解决方案

Pho*_*ton 5

如果图像内容已经是黑白的,而您只需要转换,请使用:

convert input.tif -depth 1 output.tif
Run Code Online (Sandbox Code Playgroud)

如果您还需要对图像进行阈值处理,请使用以下内容:

convert input.tif -separate -black-threshold 128 -depth 1 output.tif
Run Code Online (Sandbox Code Playgroud)