【问题标题】:How can I combine these two imagemagick convert commands?如何结合这两个 imagemagick convert 命令?
【发布时间】:2021-08-07 00:18:36
【问题描述】:

如何组合以下两个 imagemagick convert 命令?

  1. convert inverted.png -transparent white -negate temp.png
  2. convert standard.png temp.png -composite final.png

我无法弄清楚语法,但我确定当我看到答案时我会踢自己。

【问题讨论】:

    标签: image-processing imagemagick


    【解决方案1】:

    你有几个选择。

    首先,你可以先加载倒置的图像并将其取反,然后再加载第二个并交换顺序:

    convert inverted.png -transparent white -negate standard.png +swap -composite result.png
    

    或者,您可以按正确的顺序加载它们,但使用括号确保只有第二个被否定:

    convert standard.png                             \
       \( inverted.png -transparent white -negate \) \
       -composite result.png
    

    顺便说一句,这是旧的 v6 语法,您现在应该使用 v7,它是:

    magick inverted.png -transparent white -negate standard.png +swap -composite result.png
    

    【讨论】:

    • 谢谢!我会检查我的工具,看看是什么,但我的构建系统此时已经有几年的历史了。我会尽快将内容迁移到 v7
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-25
    • 2012-09-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多