Home > Backend Development > PHP Tutorial > Example of using Imagick to operate PSD files in PHP, _PHP tutorial

Example of using Imagick to operate PSD files in PHP, _PHP tutorial

WBOY
Release: 2016-07-13 10:08:59
Original
829 people have browsed it

Example of using Imagick to operate PSD files in PHP,

Reference:
http://www.php.net/manual/zh/book.imagick.php

Premise

Copy code The code is as follows:

$im = new Imagick("test.psd");

Get the number of layers

Copy code The code is as follows:

$num_layers = $im->getNumberImages();

Get all parameters:

Copy code The code is as follows:

for ($i = 0, $num_layers = $im->getNumberImages(); $i < $num_layers; ++$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'); //Export all layers to separate png files
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/947927.htmlTechArticleExample of using Imagick to operate PSD files in PHP, reference: http://www.php.net/manual/ zh/book.imagick.php The premise copy code is as follows: $im = new Imagick("test.psd"); Get the number of layers...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template