title: Imagemagick expand image border
body: <p>I'm looking for a way in PHP Imagemagick to detect an image's edges, expand the edge area, and put a solid color behind it. Here's the input image:</p>
  
  <p><img src="https://i.stack.imgur.com/Ymjtk.jpg" alt=""></p>
  
  <p>And this would be the expected output:</p>
  
  <p><img src="https://i.stack.imgur.com/xKbCY.jpg" alt=""></p>
  
  <p>Is this possible with Imagemagick?</p>