title: Changing pixel color value at a specific position with ImageMagick
body: <p>I have a script like this:</p>
  
  <pre><code>// Loop over image
  $size = $im-&gt;getImageGeometry(); 
  $w = $size['width']; 
  $h = $size['height']; 
  
  for ($i=0; $i&lt;$w; $i++) {
      for ($j=0; $j&lt;$h; $j++) {
          $pixel = $im-&gt;getImagePixelColor($j,$i);
          $color = $pixel-&gt;getColor();
          $pixel-&gt;setColor("rgb(0,0,255)");     
      }
  }
  </code></pre>
  
  <p>Preferably I'd like the <code>setColor</code> command to change the color of the pixel at the specified (x,y) location, so that when I call something like: </p>
  
  <pre><code>echo '&lt;img src="data:image/jpg;base64,'.base64_encode($im-&gt;getImageBlob()).'" alt="" /&gt;';
  </code></pre>
  
  <p>An updated image will show. However, this does not work since I guess the <code>$pixel</code> was returned by value instead of by reference. It would actually be preferable if there was a <code>getImagePixelColor</code> method but I can't seem to find anything on it. </p>
  
  <p>Does anyone know of a way to do this with imagemagick, or maybe recommend a library in php that can do this easily? </p>