Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read psd file using php

Tags:

php

psd

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.

like image 558
Dipesh Parmar Avatar asked Jul 02 '13 13:07

Dipesh Parmar


People also ask

How can I open a PSD file without Photoshop?

GIMP is a free, open source alternative to Photoshop. It can open PSD files and even preserves layer information. GIMP is the most powerful option on this list and will allow you to make other modifications to the file.

What program opens PSD files?

PSD files are the native file format of Adobe Photoshop. You've probably seen files with the . psd extension format, especially if you've been an Adobe Photoshop user. Most commonly used by designers and artists, Photoshop Documents are powerful tools for image data storage and creation.

How can I open a PSD file without opening it?

It' called QuickLook (from the developer Paddy Xu) and works really well. Open a folder on Windows Explorer, select a file and press the Space bar. Just keep the original Explorer window selected (not the QuickLook preview window) and you can even use the arrow keys to navigate between the files. Enjoy!


1 Answers

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.

like image 158
Frxstrem Avatar answered Sep 18 '22 14:09

Frxstrem