<?php
$image = new Imagick('YourImageLocation.tif');
$count = $image->getNumberImages();
echo "<h3 style=\"font: bold 12pt Arial\">从 TIF 中提取的总图像数量 ".
":".$image->getNumberImages()."</h3>";
for ($x = 1;$x <= $image->getNumberImages(); $x++) {
$image->previousImage();
$image->thumbnailImage( 400, null );
$image->writeImage('img'.$count.'.png');
$count--;
}
?>
<html>
<head>
<title>从 TIFF 中提取图像</title>
</head>
<body>
<table cellspacing="10" style="background: #ddd"><tr>
<?php
for ($x = 1;$x <= $image->getNumberImages(); $x++) {
echo "<td><img src=\"img$x.png\"<br /><p style=\"font: bold 12pt Arial;".
"text-align: center\">图像 $x (png)</p></td>";
}
?>
</tr></table>
</body>
</html>