php imagemagick创建一个Tiled Pyramid TIFF [英] php imagemagick create a Tiled Pyramid TIFF

查看:168
本文介绍了php imagemagick创建一个Tiled Pyramid 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命令行工具,正常情况下应该是这样的:

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

我测试这个命令并且它有效。但在PHP中,似乎我无法设置tile-geometry。当我测试php生成的tif文件和iipimage服务器日志告诉我这个文件没有平铺。任何人都知道如何通过平铺金字塔tiff?纯粹是通过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);
?>


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".

解决方案

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");
?>

这篇关于php imagemagick创建一个Tiled Pyramid TIFF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆