---
Product: psd
Platform: java
Page Type: docs
Canonical URL: https://docs.aspose.org/psd/java/developer-guide/sections
---

# Sections

The section classes of Aspose.PSD FOSS for Java: how a PSD file is split into header, color mode data, image resources, layer and mask information and image data, and which classes model each part.

## 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](../core-api/) and [Layers](../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](../layers/).

---

### API Reference Summary

| Class | Description |
|---|---|
| [PsdHeader](https://reference.aspose.org/psd/java/psdheader/) | The document header |
| [ColorData](https://reference.aspose.org/psd/java/colordata/) | The color mode data section |
| [ImageResourcesSection](https://reference.aspose.org/psd/java/imageresourcessection/) | The image resources section |
| [LayerAndMaskSection](https://reference.aspose.org/psd/java/layerandmasksection/) | The layer and mask information section |
| [ImageData](https://reference.aspose.org/psd/java/imagedata/) | The merged image data |
| [PsdImageDocumentState](https://reference.aspose.org/psd/java/psdimagedocumentstate/) | The parsed sections of a document |

## See Also

- [Aspose.PSD — Enterprise Documentation](https://docs.aspose.com/psd/)