Even though thumbnailImage is meant to produce the smallest file size image possible, i found it didn't. I put together this code and bordering different compression settings, found it produced the smallest file size:
<?php
$maxsize=550;
$image = new Imagick('input_image_filename_and_location');
if($image->getImageHeight() <= $image->getImageWidth())
{
$image->resizeImage($maxsize,0,Imagick::FILTER_LANCZOS,1);
}
else
{
$image->resizeImage(0,$maxsize,Imagick::FILTER_LANCZOS,1);
}
$image->setImageCompression(Imagick::COMPRESSION_JPEG);
$image->setImageCompressionQuality(75);
$image->stripImage();
$image->writeImage('output_image_filename_and_location');
$image->destroy();
?>
I found setCompression to not function at all and had to use setImageCompression. The stripImage call is needed and strips out unneeded meta data. You can choose whatever filter you want, but i found lanczos to be the best for image reduction, though it is more computationally heavy.