PHP: get the position (x, y) of the PSD file layer

I use Imagemagick with PHP and want to get the position of the layer (x, y), but I donโ€™t know how to do it.

I read the PSD file in PHP and read each layer of it as follows:

for ($i = 0, $num_layers = $im->getNumberImages(); $i < $num_layers; ++$i) { ... 
+2
php imagemagick psd
source share
1 answer
 <?php 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"]."<br />\n"); print("w,h: " . $pagedata["width"].", ".$pagedata["height"]."<br />\n"); //export layer //$im->writeImage('layer_' . $i . '.png'); } ?> 
+7
source share

All Articles