<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Composite one image onto another</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.compareimages.html">Imagick::compareImages</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.construct.html">Imagick::__construct</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="imagick.compositeimage" class="refentry"> <div class="refnamediv"> <h1 class="refname">Imagick::compositeImage</h1> <p class="verinfo">(PECL imagick 2.0.0)</p><p class="refpurpose"><span class="refname">Imagick::compositeImage</span> — <span class="dc-title">Composite one image onto another</span></p> </div> <div class="refsect1 description" id="refsect1-imagick.compositeimage-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>Imagick::compositeImage</strong></span> ( <span class="methodparam"><span class="type"><a href="class.imagick.html" class="type Imagick">Imagick</a></span> <code class="parameter">$composite_object</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$composite</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$x</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$y</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$channel</code><span class="initializer"> = Imagick::CHANNEL_DEFAULT</span></span> ] )</div> <p class="para rdfs-comment"> Composite one image onto another at the specified offset. Any extra arguments needed for the compose algorithm should passed to setImageArtifact with 'compose:args' as the first parameter and the data as the second parameter. </p> </div> <div class="refsect1 parameters" id="refsect1-imagick.compositeimage-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">composite_object</code></dt> <dd> <p class="para"> Imagick object which holds the composite image </p> </dd> <dt> <code class="parameter">compose</code></dt> <dd> <p class="para"> Composite operator. See <a href="imagick.constants.html#imagick.constants.compositeop" class="link">Composite Operator Constants</a> </p> </dd> <dt> <code class="parameter">x</code></dt> <dd> <p class="para"> The column offset of the composited image </p> </dd> <dt> <code class="parameter">y</code></dt> <dd> <p class="para"> The row offset of the composited image </p> </dd> <dt> <code class="parameter">channel</code></dt> <dd> <p class="para"> Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of <a href="imagick.constants.html#imagick.constants.channel" class="link">channel constants</a>. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-imagick.compositeimage-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success. </p> </div> <div class="refsect1 examples" id="refsect1-imagick.compositeimage-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3899"> <p><strong>Example #1 Using <span class="function"><strong>Imagick::compositeImage()</strong></span>:</strong></p> <div class="example-contents"><p> Composite two images with the 'mathematics' compose method </p></div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">// Equivalent to running the command<br />// convert src1.png src2.png -compose mathematics -define compose:args="1,0,-0.5,0.5" -composite output.png<br /><br /></span><span style="color: #0000BB">$src1 </span><span style="color: #007700">= new \</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">"./src1.png"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$src2 </span><span style="color: #007700">= new \</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">"./src2.png"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$src1</span><span style="color: #007700">-></span><span style="color: #0000BB">setImageVirtualPixelMethod</span><span style="color: #007700">(</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">::</span><span style="color: #0000BB">VIRTUALPIXELMETHOD_TRANSPARENT</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$src1</span><span style="color: #007700">-></span><span style="color: #0000BB">setImageArtifact</span><span style="color: #007700">(</span><span style="color: #DD0000">'compose:args'</span><span style="color: #007700">, </span><span style="color: #DD0000">"1,0,-0.5,0.5"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$src1</span><span style="color: #007700">-></span><span style="color: #0000BB">compositeImage</span><span style="color: #007700">(</span><span style="color: #0000BB">$src2</span><span style="color: #007700">, </span><span style="color: #0000BB">Imagick</span><span style="color: #007700">::</span><span style="color: #0000BB">COMPOSITE_MATHEMATICS</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$src1</span><span style="color: #007700">-></span><span style="color: #0000BB">writeImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"./output.png"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-imagick.compositeimage-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="imagick.setimageartifact.html" class="function" rel="rdfs-seeAlso">Imagick::setImageArtifact()</a> - Set image artifact</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.compareimages.html">Imagick::compareImages</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.construct.html">Imagick::__construct</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>