简体   繁体   中英

ImageMagick compose:args=“” to Magick++ API

I am trying to convert the following ImageMagick command to 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++. Without the compose:args= part, the Magick++ code is as follows:

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?

You'll need to define the image artifact on the inbound composite image.

#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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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