title: PHP - Mask polygon over image
body: <p>Hi Everyone (this is my first post),</p>
  
  <p>I am trying to figure a way of cropping a polygon out of an image. I have been reading other similar code. It seems that most code is based around the following process:</p>
  
  <ul>
  <li>Resize the image to fit the width and height of the polygon shape,</li>
  <li>Create a blank image of an unusual colour the same size,</li>
  <li>Overlay transparent pixels in the shape of the polygon,</li>
  <li>Overlay that on to the resized image</li>
  <li>Set the unusual colour to be transparent...</li>
  </ul>
  
  <p>My problem is I do not want the code to be reliant on the unusual colour not being in the original image. Does anyone have a better method or some code which I can use to check if the unusual colour is in the image.</p>
  
  <p>On a side note once I have cropped them I am looking to add a border only around the top and the left sides of the shape and three pixels in the corners to achieve a rounded corner effect... if anyone has any ideas about that then please also post.</p>