Re: Merging two images

Bob Friesenhahn <[email protected]> Tue, 27 Oct 2009 10:11:39 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <[email protected]>
On Tue, 27 Oct 2009, Felix Saphir wrote:

> Hello everyone,
>
> Probably a very simple question, but what is the correct way to merge
> two images side by side using the Magick++-API?

There are several different ways to accomplish this with different 
amounts of control and convenience.  It can be done via appendImages() 
or montageImages() as defined in Magick++/STL.h.  These are the most 
automated ways to perform the task.

It can also be done (the hard way) by creating a canvas image large 
enough for the two images to fit, and then using the Image composite() 
method to composite the two images in the desired locations using the 
CopyCompositeOp composition operator.  This approach requires that you 
do all the size and placement computations yourself.

The bold and sophisticated user could also accomplish it via 
mosaicImages() or flattenImages(), which use several images in a 
sequence and composites using page offsets and composition operators.

Bob
--
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference