php imagick 获取psd图层信息

来源:互联网 发布:影片去码软件 编辑:程序博客网 时间:2024/05/21 00:18
php imagick 获取psd图层信息
getNumberImages();for ($i = 1, $num_layers = $im->getNumberImages(); $i < $num_layers; ++$i) {    $im->setImageIndex($i);         //this      $im->setIteratorIndex($i);      //or this is kinda redundant    $pagedata = $im->getImagePage();    $pagedata['label'] = $im->getImageProperties("*")['label'];    $allinfo[] =$pagedata;   $im->writeImage($pagedata['label'] . '.png'); //导出所有图层到单独的png文件}print_r($allinfo);exit();
输出数组如下width是图片宽度height是图片高度x和y都是图片相对于容器的位置label是图层名字 一般用英文 不会乱码
Array(    [0] => Array        (            [width] => 750            [height] => 1206            [x] => 0            [y] => 0            [label] => bg        )    [1] => Array        (            [width] => 346            [height] => 260            [x] => 292            [y] => 472            [label] => wef1        )    [2] => Array        (            [width] => 269            [height] => 221            [x] => 49            [y] => 40            [label] => wef        ))


查看原文:http://newmiracle.cn/?p=1390
0 0
原创粉丝点击