Imagemagick:使用黑白蒙版蒙版多个图像

问题描述 投票:0回答:1

我有一系列黑白图像,像这样:

ImageMagick 使用

connected-components

将它们转换为蒙版
magick *.png -define connected-components:area-threshold=130 -define connected-components:mean-color=true -connected-components 8 -negate mask\mask-%02d.png

之后我想将此蒙版应用于原始图像并获得没有网格线的图像。

如何使用一个 ImageMagick 命令做到这一点?我有一系列图像,没有一个。

image-processing imagemagick mask image-manipulation imagemagick-convert
1个回答
2
投票

一种方法可能是将两个图像合成在一起,在每个像素位置选择两个图像中较暗的那个:

magick aaeDd.png Sf07q.png -compose darken -composite result.jpg


如果你想在一个命令中完成所有步骤,你可以使用:

magick aaeDd.png \
  \(                                                 \
     +clone                                          \
     -define connected-components:area-threshold=130 \
     -define connected-components:mean-color=true    \
     -connected-components 8 -negate                 \
  \) -compose darken -composite result.jpg
© www.soinside.com 2019 - 2024. All rights reserved.