title: center crop with gravity using Imagick and PHP
body: <p>I'm looking to center crop and image using Imagick PHP apis (not command line version of Imagick).</p>
  
  <p>Essentially I want to do what is possible via command line, using API. Here is an example via command line:
  <a href="http://www.imagemagick.org/Usage/crop/#crop_gravity" rel="noreferrer">http://www.imagemagick.org/Usage/crop/#crop_gravity</a></p>
  
  <p>Here is what I'm doing (not working). It always crops the upper left corner of the source:</p>
  
  <pre><code>        $this-&gt;imagickObj-&gt;setGravity(\Imagick::GRAVITY_CENTER);
          $this-&gt;imagickObj-&gt;cropImage(300,250,0,0);
          $this-&gt;imagickObj-&gt;setImagePage(0, 0, 0, 0);
  </code></pre>
  
  <p>Why is the setGravity not applying to the image before the crop? <a href="http://www.php.net/manual/en/function.imagick-setgravity.php" rel="noreferrer">http://www.php.net/manual/en/function.imagick-setgravity.php</a> says it should apply to the object (in this case the single image)...</p>