Maison  >  Article  >  php教程  >  PHP中使用Imagick操作PSD文件实例,

PHP中使用Imagick操作PSD文件实例,

WBOY
WBOYoriginal
2016-06-13 09:16:281614parcourir

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

    $im->setImageIndex($i);         //this
    $im->setIteratorIndex($i);      //or this is kinda redundant
    $pagedata=$im->getImagePage();
    //print("x,y: " + $pagedata["x"].", ".$pagedata["y"]."
\n");
    //print("w,h: " + $pagedata["width"].", ".$pagedata["height"]."
\n");
 
    foreach($im->getImageProperties("*") as $k => $v) print("$k: $v
\n");
 
    //export layer
    //$im->writeImage('layer_' . $i . '.png'); //导出所有图层到单独的png文件
}

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn