Download the PHP package pixelfactory/psd-php without Composer
On this page you can find all versions of the php package pixelfactory/psd-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package psd-php
PSD-PHP
Library for reading psd file
Installation
Usage
Create an instance of the 'Psd' class by passing the file path.
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
Getting file sizes
Saving an image
Working with the layers tree
[Layers tree] Moving from directories
[Layers tree] Getting information about a layer
[Layers tree] Saving a layer image
Professional
The psd class has the same structure as the psd file.
Name | Method | Examples |
---|---|---|
File header | getHeader | Link |
Color mode data | -¹ | |
Image resources | getResources | Link |
Layer and mask information | getLayers | Link |
Image data | getImage | Link |
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
You can call the 'getHeader' method to get class implements HeaderInterface 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:
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
To find the necessary resource, you need to call the method getResources (this method return class what extends from ResourcesInterface). \ Next, you can use the search by the resource name or resource id.
Example. Get guides:
Layer and mask information
Image data
This section stores the image. You can get a class for exporting an image using the method getExporter. \ Now is available only png class for export image:
All exporters classes implements interface: ImageExportInterface \ You can export the image to the Imagick class or save it.