Merging 2 wands into 1

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
var0l

Merging 2 wands into 1

Post by var0l »

Hi,

I'm new to ImageMagick, but found it to be a great library. Now to the point. I'm trying to merge 2 MagckWands into 1 to montage them later on. How to achieve that (I've read the docs, but could not find a necessary function).

Here is a general idea of what I'm trying to do:

Code: Select all

      MagickReadImage(wand1, "im1.jpg");
      MagickReadImage(wand2, "im2.jpg");

      (do sth with the images)

      newwand = MagickMontageImage(mergewands(wand1,wand2),(...));
Please post anything that might help with this problem, else than write and read them, to a single wand. Thanks in advance.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Merging 2 wands into 1

Post by el_supremo »

You read each of the images in to the same magick wand and then do a montage.

Code: Select all

      MagickReadImage(wand1, "im1.jpg");
      MagickReadImage(wand1, "im2.jpg");
      MagickReadImage(wand1, "im3.jpg");

      .....

	d_wand = NewDrawingWand();
	p_wand = NewPixelWand();
	DrawSetFont(d_wand,"Arial");
	DrawSetFontSize(d_wand,12);

	PixelSetColor(p_wand,"black");
	DrawSetStrokeColor(d_wand,p_wand);
	DrawSetFillColor(d_wand,p_wand);

      newwand = MagickMontageImage(wand1,d_wand,"2x2+0+0","240x240+20+15",ConcatenateMode,"0x0+0+0");

You'll have to adjust the colours, geometry strings etc. to suit your needs.

Pete
var0l

Re: Merging 2 wands into 1

Post by var0l »

I'm sorry, but you have missed the point. I know how to do a successful montage. The problem is, that before performing the montage I want to prepare the images (in a different way). E.g. floodfill the background, perform a contrast and sharpness adjustment and so on.

That is why I need two different wands (for two images). After I'm finished with preparing the images solo, I want to merge them using montage, but here I need them all in a single wand, that is why I asked the question about merging wands.

In my example that was the “(do sth with the images)” part.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Merging 2 wands into 1

Post by el_supremo »

OK, I think I understand now. You need to use the MagickAddImage function.

http://imagemagick.org/api/magick-image ... ckAddImage

The documentation for it appears to have a cut and paste error because it refers to a splice wand.
The images in add_wand are added to those already in wand.

Hope I understood it this time :-)

Pete
var0l

Re: Merging 2 wands into 1

Post by var0l »

Thanks very, very much. Yest this is it. I've missed it just because I was searching for the functions with a "wand" inside the name :)

Again thank you very much.
Post Reply