PHPackages                             pixelfactory/psd-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pixelfactory/psd-php

ActiveLibrary

pixelfactory/psd-php
====================

Library for reading psd file

1.0.0(3y ago)19626↑20%2[2 issues](https://github.com/PixelFactory/psd-php/issues)MITPHP

Since Jan 9Pushed 2y ago3 watchersCompare

[ Source](https://github.com/PixelFactory/psd-php)[ Packagist](https://packagist.org/packages/pixelfactory/psd-php)[ RSS](/packages/pixelfactory-psd-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PSD-PHP
=======

[](#psd-php)

 [![Logo](https://github.com/PixelFactory/psd-php/raw/master/assets/logo.svg)](https://github.com/PixelFactory/psd-php/blob/master/assets/logo.svg)### Library for reading psd file

[](#library-for-reading-psd-file)

---

### Installation

[](#installation)

```
composer require pixelfactory/psd-php

```

### Usage

[](#usage)

Create an instance of the 'Psd' class by passing the file path.

```
require_once '../vendor/autoload.php';

$psd = new \Psd\Psd('./image.psd');
```

Then you have two ways to use the library, 'simple' and 'professional'
**Simple** - way is suitable for those who are not familiar with the structure of the psd file and just want to get the necessary information
**Professional** - way can be used by more experienced developers to get access to a specific part of the file

### Simple

[](#simple)

#### Getting file sizes

[](#getting-file-sizes)

```
$psd = new \Psd\Psd('./image.psd');
$psdSimpleMethods = $psd->getShortcuts();

echo $psdSimpleMethods->getWidth();    // Print file width
echo $psdSimpleMethods->getHeight();   // Print file height
```

#### Saving an image

[](#saving-an-image)

```
$psd = new \Psd\Psd('./image.psd');
$psdSimpleMethods = $psd->getShortcuts();

var_dump($psdSimpleMethods->savePreview('./out.png')); // Print 'true' if file be saved
```

#### Working with the layers tree

[](#working-with-the-layers-tree)

```
// TODO
```

##### \[Layers tree\] Moving from directories

[](#layers-tree-moving-from-directories)

```
// TODO
```

##### \[Layers tree\] Getting information about a layer

[](#layers-tree-getting-information-about-a-layer)

```
// TODO
```

##### \[Layers tree\] Saving a layer image

[](#layers-tree-saving-a-layer-image)

```
// TODO
```

### Professional

[](#professional)

The psd class has the same structure as the psd file.

   Name Method Examples      [ File header ](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_19840)  getHeader [Link](#header-data)    [ Color mode data ](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_71638)  -¹    [ Image resources ](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_69883)  getResources [Link](#image-resources)    [ Layer and mask information ](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_75067)  getLayers [Link](#layer-and-mask-information)    [ Image data ](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_89817)  getImage [Link](#image-data)  1 - 'Color mode data' has no method because it is skipped and not processed by the library. This should not affect the work with most images because they have the "rgb" or "cmyk" color mode. This section is used only in the "Indexed" or "Duotone" color mode.

#### Header data

[](#header-data)

You can call the 'getHeader' method to get class implements [HeaderInterface](https://github.com/PixelFactory/psd-php/blob/master/src/FileStructure/Header/HeaderInterface.php) what contains methods for all fields image header section.

   File header section HeaderInterface methods     Signature    Version getVersion   Reserved -   Channels getChannels   height getRows (Alias: getHeight)   width getCols (Alias: getWidth)   Depth getDepth   Color mode getMode (Convert mode number to text: modeName)   - parse   - getNumPixels   - getChannelLength   - getFileLength  Example:

```
echo $psd->getHeader()->getMode();     // Return file mode (int)
echo $psd->getHeader()->modeName();    // Return file mode name
echo $psd->getHeader()->getChannels(); // Return file count channels
```

#### Image resources

[](#image-resources)

Image resources section store additional information. Such as guides, etc.
The library is working with resources:

- Guides(1032)
- Layer Comps(1065)
- Resolution Info(1005)

The full list of resources you can be found in the [documentation](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_38034)

To find the necessary resource, you need to call the method getResources (this method return class what extends from [ResourcesInterface](https://github.com/PixelFactory/psd-php/blob/master/src/LazyExecuteProxy/Interfaces/ResourcesInterface.php)).
Next, you can use the search by the resource name or resource id.

Example. Get guides:

```
/** @var \Psd\FileStructure\Resources\Resource\Guides\GuidesData[] $guides */
$guides = $psd
    ->getResources()
    ->getResourceById(\Psd\FileStructure\Resources\Resource\ResourceBase::RESOURCE_ID_GUIDES)
    ->getData();

foreach ($guides as $guide) {
    printf("%s - %s\n", $guide->getDirection(), $guide->getLocation()); // Result: 'vertical - 100'
}
```

#### Layer and mask information

[](#layer-and-mask-information)

```
// TODO
```

#### Image data

[](#image-data)

This section stores the image. You can get a class for exporting an image using the method [getExporter](https://github.com/PixelFactory/psd-php/blob/master/src/FileStructure/Image/Image.php#L47).
Now is available only [png](https://github.com/PixelFactory/psd-php/blob/master/src/Image/ImageExport/Exports/Png.php) class for export image:

```
/* @var Psd\Image\ImageExport\Exports\Png $exporter */
$exporter = $psd->getImage()->getExporter(\Psd\Image\ImageExport\ImageExport::EXPORT_FORMAT_PNG);
```

All exporters classes implements interface: [ImageExportInterface](https://github.com/PixelFactory/psd-php/blob/master/src/Image/ImageExport/Exports/ImageExportInterface.php)
You can export the image to the [Imagick](https://www.php.net/manual/en/class.imagick.php) class or save it.

```
/** @var Imagick $image */
$image = $exporter->export();
/** @var bool $status */
$status = $exporter->save('./out.png');
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1216d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b2f5b9a2b9ed2829fcad383a0b5523368524cbc956018316704f0210c06ba747?d=identicon)[LoginovIlya](/maintainers/LoginovIlya)

---

Top Contributors

[![LoginovIlya](https://avatars.githubusercontent.com/u/224177579?v=4)](https://github.com/LoginovIlya "LoginovIlya (8 commits)")

### Embed Badge

![Health badge](/badges/pixelfactory-psd-php/health.svg)

```
[![Health](https://phpackages.com/badges/pixelfactory-psd-php/health.svg)](https://phpackages.com/packages/pixelfactory-psd-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
