问题
well, i have a problem as the title says. My test function is like this:
$imagePath="/tmp/511a3874a0da1";
$pngName=$imagePath.".png";
$tifName=$imagePath.".tif";
$tempImg = new Imagick();
$tempImg->readImage($pngName);
//$tempImg->roundCorners(150,150);
//$image->transformImage("100x100", "100x100");
$tempImg->setFormat('ptif');
$tempImg->setImageColorSpace(5);
$tempImg->writeImage($tifName);
well, it generate a tif file, as the manual says, ptif is the format of 'tiled pyramid tiff'. I check the imagemagick command line tools, nomally, it should be like this:
convert 511a38e9a5cc5.png -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:o.tif'
i test this command and it works. but in php ,it seems i have no way to set tile-geometry. When i test the php-generated tif file and the iipimage sever log tell me this file is not tiled. Anyone knows how to genetate a tiled pyramid tiff ? purely by php, not something like "exec xxx".
回答1:
I am not very familiar with tiled pyramid TIFFs, but maybe something like this:
<?php
$tempImg = new Imagick();
$tempImg->readImage("image.png");
$tempImg->setFormat('ptif');
$tempImg->setImageDepth(8);
$tempImg->setOption('tiff:tile-geometry','256x256');
$tempImg->writeImage("result.tif");
?>
来源:https://stackoverflow.com/questions/14834989/php-imagemagick-create-a-tiled-pyramid-tiff