Introduction
Aspose.PSD FOSS for Java is an open-source library for working with Adobe Photoshop PSD and PSB (large document) files from Java code. It is released under the MIT license and is published on Maven Central. The library has no third-party runtime dependency; it needs Java 11 or later, and the java.desktop module when you load indexed-color documents, because it uses java.awt.Color there.
The library is built around the PsdImage class, which extends the Image base class, and the Layer class. PsdImage.load opens a document from a file path or an InputStream, and PsdImage.save writes it back. Rendering, export, conversion and pixel decoding are outside what the library does.
It is meant for developers who need to read design files, report on their layer structure, or make small metadata changes in batch, without Adobe Photoshop and without a commercial license.
What’s Included
Document Inspection
PsdImage reports getWidth(), getHeight(), getBitsPerChannel(), getColorMode(), getCompression() and getChannelsCount(). RGB, CMYK and indexed-color PSD files load, and RGB PSB files load.
Layer Metadata
PsdImage.getLayers() returns the Layer objects of a document. Each layer has a name, visibility, opacity, clipping, blend mode key and position. getOpacity() returns a byte that holds a value from 0 to 255.
Layer Edits
setName(String), setVisible(boolean) and setOpacity(byte) change a layer. After you save the document and load it again, the new values are in the file. In the library’s own tests, a document that you save without changes is written back identically. Layer names are saved as ASCII text, so use these edits on files whose layer names are ASCII.
Error Handling
PsdImage.load(InputStream) throws the checked PsdLoadException for an invalid signature or header, an empty stream, or data that ends before the end of the image resources or layer sections. PsdImage.load(String) reports the same problems as a RuntimeException that wraps it.
Setters That Are Not Supported
Seven setters always throw UnsupportedOperationException in this edition: PsdImage.setActiveLayer, setImageResources, setGlobalLayerResources and setHasTransparencyData, and Layer.setChannelInformation, setLayerMaskData and setLayerBlendingRangesData. Adding, removing or reordering layers is not a supported edit.
Quick Start
Add the library to your Maven build:
<dependency>
<groupId>org.aspose</groupId>
<artifactId>aspose-psd-foss</artifactId>
<version>26.11.0</version>
</dependency>Then call PsdImage.load with the path of a PSD or PSB file, read the header and the layers, and call PsdImage.save when you have changed layer metadata. The Quick Start lists the calls in order.
Supported Formats
| Format | Extension | Read | Write |
|---|---|---|---|
| PSD | .psd | ✓ | ✓ |
| PSB | .psb | ✓ | ✓ |
Open Source & Licensing
Aspose.PSD FOSS for Java is MIT licensed, which allows commercial use, modification and redistribution. The source is on GitHub and the release artifacts are on Maven Central.