将内容类型图像/ TIFF发送到浏览器不起作用

I'm using Imagick (6.7.7-4 and module version 3.2.0RC).

I am trying to create an image and render it in the browser dynamically, for example, by HTML

<img src='image_generator.php?QUERY_PARAMS_TO_DETERMINE_TEXT'>

This is the image_generator.php content:

/* Create text */
$draw->setFillColor('white');
$draw->setFontSize( 19 );
$draw->setGravity(Imagick::GRAVITY_CENTER);
$draw->annotation(0, -50, 'points');
$image->drawImage($draw);

/* Give image a format */
$image->setImageFormat('tiff'); // png works

/* Output the image with headers */
header('Content-type: image/tiff'); // png works
echo $image;

When I open image_generator.php in php and the image format is set to TIFF, it automatically downloads a PHP file and does not show an image as of the PNG case.