title: PHP+Imagick - PNG Compression
body: <p>How do I efficiently compress a PNG? In my case, the images are small grayscale images with transparency.</p>
  
  <p>Currently I'm playing with this:</p>
  
  <pre><code>// ...
  
  $im-&gt;setImageFormat('png');
  $im-&gt;setImageColorspace(\Imagick::COLORSPACE_GRAY);
  $im-&gt;setImageCompression(\Imagick::COMPRESSION_LZW);
  $im-&gt;setImageCompressionQuality(9);
  $im-&gt;stripImage();
  $im-&gt;writeImage($url_t);
  </code></pre>
  
  <p>As Imagick doesn't offer <code>COMPRESSION_PNG</code>, I've tried LZW but there's almost no change in the filesize (usually it's even bigger than before).</p>
  
  <p>If I open the image in GIMP and simply save it, the filesize gets drastically reduced (e.g. 11,341 B --> 3,763 B or 11,057 B --> 3,538).</p>
  
  <p>What is the correct way of saving a compressed PNG with Imagick?</p>