【问题标题】:ImageMagick compose:args="" to Magick++ APIImageMagick compose:args="" 到 Magick++ API
【发布时间】:2016-03-22 05:36:22
【问题描述】:

我正在尝试将以下 ImageMagick 命令转换为 Magick++:

convert input-1.jpg input-2.jpg -compose blend -define compose:args="25,75" -composite result.jpg

我在使用 -define compose:args="25,75" 时遇到了困难,我在 Magick++ 中找不到它的等价物。没有compose:args=部分,Magick++代码如下:

Magick::Image input1, input2;
input1.read("input-1.jpg");
input2.read("input-2.jpg");
input1.composite(input2, 0,0, BlendCompositeOp);

谁能向我解释一下compose:args 部分,或者更好地告诉我它的Magick++ 等价物吗?

【问题讨论】:

    标签: c++ image-processing imagemagick magick++


    【解决方案1】:

    您需要在入站合成图像上定义图像artifact

    #include <iostream>
    #include <Magick++.h>
    
    using namespace Magick;
    
    int main(int argc, const char * argv[]) {
    
        InitializeMagick(argv[0]);
        Image alpha, beta;
        alpha.read("wizard:");
        beta.read("logo:");
        // -define compose:args="25,75"
        beta.artifact("compose:args", "25,74");
        alpha.composite(beta, 0, 0, BlendCompositeOp);
        alpha.write("/tmp/out.jpg");
        return 0;
    }
    

    【讨论】:

    • 谢谢一百万。我当时正在向 Magick++ 源代码添加“Artifact”函数并编译整个 ImageMagick。 :p
    • 如果您愿意回答,我还有一个问题。 :)
    • 感谢@MarkSetchell 的积极反馈,Zindarod 随时发布新问题,或者如果您需要更多详细信息,请在此处发表评论。
    • @emcconville 我想知道这是什么版本的 Magick++ ......我在使用的 Image 类中没有看到任何“工件”方法......
    猜你喜欢
    • 2015-01-08
    • 2016-03-23
    • 2011-04-23
    • 2011-05-10
    • 2015-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    相关资源
    最近更新 更多