Overview
A PSD or PSB file consists of five sections: the header, the color mode data, the image resources, the layer and mask information, and the image data. The package org.aspose.psd.sections has a public class for each, and PsdImageDocumentState holds the parsed sections of one document. They are low-level building blocks that the loader and writer use. PsdImage keeps its parsed sections internal, so ordinary code reads the document through PsdImage and Layer instead (see Core API and Layers).
The Section Classes
| Class | Models |
|---|
PsdHeader | The header: width, height, channels, bit depth, color mode, version and whether the document is a large document (PSB) |
ColorData, PsdColorDataInfo | The Color Mode Data section and its read-only view; PsdColorDataKind says how the payload was interpreted |
ImageResourcesSection | The Image Resources section and its resource blocks |
LayerAndMaskSection | The Layer and Mask Information section, including the raw bytes that are preserved when a document is saved without changes |
ImageData, ImageDataStructure, PsdImageDataInfo | The merged image data as a compression header plus raw payload bytes, its validated layout and a read-only summary; ImageDataKind identifies the layout (Raw, Rle, Zip, Unknown or RAW_PRESERVED) |
PsdImageDocumentState | Holds the parsed header, color data, image resources, layer and mask section and image data of one document |
SeekOrigin | Seek origins (BEGIN, CURRENT, END) used by the binary reader and writer |
Tips and Best Practices
- Use
PsdImage for loading, inspecting and saving; use the section classes only when you need to read the structure of a file yourself. - The sections keep raw bytes so that a document that is saved without changes is written back unchanged.
Common Issues
| Issue | Cause | Fix |
|---|
You cannot get the PsdHeader from a PsdImage | PsdImage keeps its sections internal | Use the PsdImage getters for width, height, bits per channel, color mode and compression |
FAQ
Do I need these classes to edit a layer?
No. Edit layers through PsdImage.getLayers(); see Layers.
API Reference Summary
See Also