in reply to Optimize runtime with Image::Magick;

There is an alternative way to write directly to STDOUT:
print "Content-type: image/tiff\n\n"; binmode STDOUT; $img->Write('tif:-');
I thought this might have saved some time but when I tested it on a 75Mb tif image it took 3 seconds using both this method and ImageToBlob(). I guess that's just how long it takes to write the image.