Well, among new features of imagick there is cropThumbnailImage. It’s not really that new but it might be undocumented for most of the parts.

  1. <?php
  2.  
  3. /* Read the image */
  4. $im = new imagick( "test.png" );
  5.  
  6. /* create the thumbnail */
  7. $im->cropThumbnailImage( 80, 80 );
  8.  
  9. /* Write to a file */
  10. $im->writeImage( "th_80x80_test.png" );
  11. ?>

Let’s assume the source image in this example is 120×240. First it is scaled down to 80×160 and then cropped by the larger side (height in this case) from position x0,y40 to x80,y120. After this crop we have a fixed size 80×80 thumbnail.