Jumlins TechBlog

The coding hell and the daily IT of Niklas Jumlin

January 19th, 2010

So i was troubled with how to open and display a psd file with PHP’s imagick component.

I came to the following result, apparently imagick imports all the layers, and by using the image iterator, you can go through them.
The iterator index 0 is the whole image merged together.

By using this simple code, notice the setIteratorIndex(), i succesfully displayed a few multilayered psd files.

// *********************
// *   Developed by:   *
// * Gofolo Consulting *
// *  www.gofolo.com   *
// *********************
$im = new Imagick('Visitkort_Ver1.psd');
header("Content-Type: image/png");
echo $im;