Write Descriptors

Overview

The package org.aspose.psd.writedescriptors has one public class, PsdImageWriter. Its save method writes a PsdImageDocumentState to an OutputStream. It is the low-level writer that sits behind PsdImage.save, together with PsdImageLoader (package org.aspose.psd.loaders), which reads a document from a stream into a document state.


Use PsdImage.save

PsdImage.save(String) and PsdImage.save(OutputStream) are the supported way to write a document. In the library’s own tests a document that is saved without changes is written back identically, and a document with changed layer metadata contains the changes when it is loaded again. PsdImage.save(OutputStream) closes the stream that you pass in. See Core API and Layers.


The Writer and Loader Classes

ClassPackageRole
PsdImageWriterorg.aspose.psd.writedescriptorsWrites a PsdImageDocumentState to an OutputStream
PsdImageLoaderorg.aspose.psd.loadersLoads a PsdImageDocumentState from an InputStream
LayerAndMaskSectionWriter, LayerAndMaskSectionReaderorg.aspose.psdWrite and read the layer and mask information section
LayerRecordWriter, LayerRecordReaderorg.aspose.psd.layersWrite and read the layer records
BigEndianWriter, BigEndianReaderorg.aspose.psdWrite and read big-endian binary data

Tips and Best Practices

  • Call PsdImage.save unless you are building your own tool on the document state.
  • Do not rely on the writer classes for anything beyond what PsdImage.save does.

Common Issues

IssueCauseFix
You want to write a document without a PsdImagePsdImageWriter.save needs a PsdImageDocumentStateLoad the file with PsdImage and save it with PsdImage.save

FAQ

Is PsdImageWriter the way to save a PSD?

No. Use PsdImage.save.


API Reference Summary

ClassDescription
PsdImageWriterWrites a document state to a stream
PsdImageLoaderLoads a document state from a stream
PsdImageDocumentStateThe parsed sections of a document

See Also