简体   繁体   English

ImageMagick compose:args =“”转换为Magick ++ API

[英]ImageMagick compose:args=“” to Magick++ API

I am trying to convert the following ImageMagick command to Magick++: 我正在尝试将以下ImageMagick命令转换为Magick ++:

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

I am having difficulty with -define compose:args="25,75" , I cannot find its equivalent in Magick++. 我在使用-define compose:args="25,75"时遇到困难,我无法在Magick ++中找到它的等效项。 Without the compose:args= part, the Magick++ code is as follows: 没有compose:args=部分,Magick ++代码如下:

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

Can anyone please explain the compose:args part to me or better yet tell me its Magick++ equivalent? 谁能向我解释compose:args部分,或者更好地告诉我它的Magick ++对等物吗?

You'll need to define the image artifact on the inbound composite image. 您需要在入站合成图像上定义图像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 ++编写compos:args

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM