title: trim whitespace around PNG in PHP
body: <p>I am using code very similar to (does the same thing as) the answer to this question: <a href="https://stackoverflow.com/questions/1669683/crop-whitespace-from-image-in-php">Crop whitespace from image in PHP</a>. I have tried this exact code as well, to the same effect:</p>
  
  <p>I find that it does not work (does not trim white space) with a PNG source, even if the background of the PNG is true white (not transparent). I can send the output to <code>imagepng</code> without issue, but if the image source is <code>imagecreatefrompng</code>, nothing is trimmed.</p>
  
  <p>Is there a reliable way to trim whitespace from a PNG using GD? Or perhaps a way to convert the color white to transparent and trim that instead? Or, other solution...?</p>