【问题标题】:Converting tiff to mode 1 bit images将 tiff 转换为模式 1 位图像
【发布时间】:2015-10-11 22:28:17
【问题描述】:

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

【问题讨论】:

    标签: image image-processing imagemagick tiff gimp


    【解决方案1】:

    如果图片内容已经是黑白的,只需转换,使用:

    convert input.tif -depth 1 output.tif
    

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

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

    【讨论】:

    • 和convert -monochrome input.tif output.tif一样吗?
    • 请注意,输入文件名之前的标志适用于输入,而不是输出(至少手册页是这么说的)。也就是说,结果并不相同。检查两者并选择最适合您的。使用阈值的好处是你可以调整它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多