How can I read psd file using php

php, psd

Solution

You can use ImageMagick for this, using something like:

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

foreach($im as $layer) {
  // do something with each $layer

  // example: save all layers to separate PNG files
  $layer->writeImage("layer" . ++$i . ".png");
}

Also, you can look at this answer to a question similar to yours, and has some code examples for how to get `x,y` positions of layers, for instance.

Problem

I need to read `PSD` file into `PHP` code and get group layers and X-Y positions. How can i do it? I've heard of ImageMagick but never worked on it. If you guys have some links to get started please provide it to me.

Original source