PsdImage and Layer: load a document, read its dimensions, color mode, bit depth, compression and channel count, walk its layers, and read its image resources.
A document can be saved back to a file or a stream. In the library’s own tests an unmodified document is written back byte for byte. The layer metadata that you can change and save is the name, visibility and opacity; position, clipping and blend mode also have setters. The library does not render images, export to PNG or JPEG, or decode pixels.
The library has no third-party runtime dependency and needs only the JDK; indexed-color documents need the java.desktop module because the library uses java.awt.Color. It is compiled for Java 11 and was run on Java 11, 17 and 21. Add it to your Maven build as org.aspose:aspose-psd-foss:26.11.0. For the enterprise product family, see Aspose.PSD — Enterprise Product Family.PsdImage.load(String) opens a PSD or PSB file from a path; PsdImage.load(InputStream) loads from a stream and declares the checked PsdLoadExceptionPsdImage reports getWidth(), getHeight(), getBitsPerChannel(), getColorMode(), getCompression() and getChannelsCount()Image.load returns an Image that is a PsdImage for a PSD or PSB filePsdImage does not report which of the two a file isPsdImage.getLayers() returns the Layer objects of the documentLayer exposes getName(), isVisible(), getOpacity(), getClipping(), getBlendModeKey() and its position (getLeft(), getTop(), getRight(), getBottom())getOpacity() returns a byte that holds a value from 0 to 255Layer.getChannelsCount() reports how many channels a layer carriesLayer.setName(String), setVisible(boolean) and setOpacity(byte) change a layer’s metadataPsdImage.save(String) and PsdImage.save(OutputStream) write the document; reloading the saved file shows the changes; save(OutputStream) closes the stream you pass in?PsdImage.getImageResources() returns the image resource blocks of the document as read-only dataPsdLoadException from PsdImage.load(InputStream); PsdImage.load(String) reports the same problems as a RuntimeException that wraps itFileNotFoundException; a null path is an IllegalArgumentExceptionUnsupportedOperationException, for example PsdImage.setImageResources and Layer.setLayerMaskDataThe library is published on Maven Central. Add this dependency to your project:
<dependency>
<groupId>org.aspose</groupId>
<artifactId>aspose-psd-foss</artifactId>
<version>26.11.0</version>
</dependency>It is MIT licensed. You can use, modify and redistribute it under the terms of the MIT license, including in commercial products.
Add org.aspose:aspose-psd-foss:26.11.0 to your Maven build. The library is published on Maven Central and has no third-party runtime dependencies.
Java 11 or later. It was built for Java 11 and run on Java 11, 17 and 21. The java.desktop module (for java.awt.Color) is needed to load indexed-color documents.
PSD and PSB (large document) files. RGB, CMYK and indexed-color PSD files and RGB PSB files were tried. Both types load with PsdImage.load.
No. The library has no rendering, export, conversion or pixel-decoding API. It loads, inspects and saves PSD and PSB structure.
PsdImage.setActiveLayer, setImageResources, setGlobalLayerResources and setHasTransparencyData, and Layer.setChannelInformation, setLayerMaskData and setLayerBlendingRangesData always throw UnsupportedOperationException.