PHP中使用Imagick操作PSD文件实例
参考资料:
http://www.php.net/manual/zh/book.imagick.php
前提
代码如下:
$im = new Imagick("test.psd");
获取图层数目
代码如下:
$num_layers = $im->getNumberImages();
获取所有参数:
代码如下:
for ($i = 0, $num_layers = $im->getNumberImages(); $i < $num_layers; ++$i) { <p> $im->setImageIndex($i); //this $im->setIteratorIndex($i); //or this is kinda redundant $pagedata=$im->getImagePage(); //print("x,y: " + $pagedata["x"].", ".$pagedata["y"]."<br/>\n"); //print("w,h: " + $pagedata["width"].", ".$pagedata["height"]."<br/>\n"); foreach($im->getImageProperties("*") as $k => $v) print("$k: $v<br/>\n"); //export layer //$im->writeImage('layer_' . $i . '.png'); //导出所有图层到单独的png文件 } </p>
相关推荐
PHP100 2019-03-28
Proudoffaith 2020-06-15
mqbeauty 2020-01-08
drise 2011-09-20
githubphpnobug 2019-04-17
zhangwei0php 2019-04-15
phptyong 2014-03-20
PHP100 2019-03-28
PHP100 2019-03-28
PHP100 2019-03-28
PHP100 2019-03-28
PHP100 2019-03-28
PHP100 2019-03-28
PHP100 2019-03-28