title: How can I convert an ImageMagic shell command to an equivalent PHP script?
body: <p>I have the following shell script that I copied almost verbatim from the <a href="http://www.imagemagick.org/Usage/annotating/" rel="nofollow noreferrer">ImageMagick manual</a>:</p>
  
  <pre><code>  convert input.jpg -background White -pointsize 32 label:'Hello world' +swap  -gravity Center -append output.jpg;
  </code></pre>
  
  <p>Now I want to run the same operation on a shared webhost (that does not seem to have the <code>convert</code> command available). On the surface the mapping from command line to PHP seems rather straightforward, but somehow it's not. The below code prints the input image unchanged.</p>
  
  <pre><code>//header('Content-type: image/jpeg');
  
  $image = new Imagick('input.jpg');
  
  $image-&gt;setBackgroundColor("White");
  $image-&gt;setPointSize(32);
  $image-&gt;setGravity(imagick::GRAVITY_CENTER);
  $image-&gt;labelImage("hello world");
  echo $image-&gt;count(); // 1
  echo $image-&gt;appendImages(True);
  //echo $image;
  </code></pre>
  
  <p>The <code>labelImage</code> function has very little documentation, and does not seem to do much at all. Furthermore, there is no <code>swap</code> function.</p>
  
  <p>What is the equivalent PHP code for adding a caption on top of the image?</p>
  
  <p>[edit]</p>
  
  <p>It seems <code>labelImage</code> just sets a property, just like <a href="http://php.net/manual/en/imagick.commentimage.php" rel="nofollow noreferrer"><code>commentImage</code></a>(example provided this time). There is a <a href="http://php.net/manual/en/imagick.render.php" rel="nofollow noreferrer"><code>render</code></a> command that looks promising, but gives an error: <code>Fatal error: Call to undefined method Imagick::render()</code>. Odd...</p>