php imagemagik创建一个平铺金字塔TIFF



好吧,正如标题所说,我有一个问题。我的测试功能是这样的:

$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);

好吧,它生成了一个tif文件,正如手册所说,ptif是"平铺金字塔tiff"的格式。我检查了imagemagick命令行工具,通常情况下,它应该是这样的:

convert 511a38e9a5cc5.png -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:o.tif'

我测试了这个命令,它就工作了。但是在php中,我似乎没有办法设置tile几何图形。当我测试php生成的tif文件时,iipimage服务器日志告诉我这个文件没有平铺。有人知道如何制造一场平铺的金字塔之争吗?纯粹由php编写,而不是类似于"exec-xxx"的东西。

我对平铺金字塔TIFF不是很熟悉,但可能是这样的:

<?php
$tempImg = new Imagick();
$tempImg->readImage("image.png");
$tempImg->setFormat('ptif');
$tempImg->setImageDepth(8);
$tempImg->setOption('tiff:tile-geometry','256x256');
$tempImg->writeImage("result.tif");
?>

最新更新