I want to run the following task:
// getting the average color of the mask area
convert demp.png \( demo_mask.png -negate \) -compose copyopacity
-composite -scale 1x1! -format "%[pixel:u.p{0,0}]" info:
via nodejs gm module using the imagemagick subclass. I can't find any good documentation/tutorial about the gm module, so I'm kind of stucked in the middle of an important task.
gm("demo_mask.png").negative(function(err, maskImg){
if(err) return Promise.reject(err);
gm("demo.png").compose("CopyOpacity")
.command("composite")
.scale(1,1)
.command('format').in('%[pixel:u.p{0,0}]')
// HOW TO GO ON HERE ? HOW TO RETURN THE INFO NOW ?
});
The problem starts with the first braces where I have to first negate a mask image before I can compose it. I'm not sure If it works if I first negate the mask and inside the callback feed that into the composition.. But the bigger problem is, how can I return infos as text ... ?